A
A
Alexander2019-07-12 09:48:27
Nginx
Alexander, 2019-07-12 09:48:27

nginx how to redirect ssl?

Dear gurus, there is such a problem:
There are 2 web servers with NGINX installed
server1 - address 192.168.1.5
server2 - address 192.168.1.9
server1 is a proxy, it is redirected to server2 via proxy pass

server {
  listen 443;
  server_name peertube.ustim.ru www.peertube.ustim.ru;

  location / {
        proxy_pass https://192.168.1.9/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
}

Accordingly, a working site is deployed on server2, and Certbot with a working certificate is also installed on server2.
With this scheme, if you open a site on a local network, then the certificate works fine, but if you open a site from an external network (Internet), then nothing works.
If I use the certificate on server1, then everything will work correctly, but I need to use the above option.
Tell me how to make a secure connection work through a proxy pass?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2019-07-12
@alterak

Question resolved. Still had to use a certificate on server1.

V
Vladimir Skibin, 2019-07-12
@megafax

You will need to use the certificate on server1 anyway, whether server2 uses it or not. If they are in the same local network, then rsync these certificates from the second server to the first one and specify them in the config and that's it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question