Question

How to install ssl on nginx which is front-end proxy to apache for subdomains

I have Nginx on port 80 which handles abc.com, one.abc.com and two.abc.com. For abc.com and one.abc.com, it redirects to Apache in port 8080. For two.abc.com, it redirects to Apache in port 8081.

The task now is to upgrade to https. Where to install the certificate - on nginx or on apache? How does https calls hold good for the subdomains one.abc.comm and two.abc.com?

Sample nginx conf: server { listen 80; server_name abc.com, one.abc.com; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_pass http://127.0.0.1:8080; } }

server {
    listen      80;
    server_name two.abc.com;
    location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;
        proxy_pass         http://127.0.0.1:8081;
    }
}

Thanks in advance.

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

You need to install the SSL certificate on Nginx and you could use a wildcard SSL certificate to cover all of your subdomains.

Hope that this helps.