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

Posted June 12, 2019 314 views
Nginx Apache

I have Nginx on port 80 which handles, and
For and, it redirects to Apache in port 8080.
For, 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 and

Sample nginx conf:
server {
listen 80;
location / {
setheader X-Real-IP $remoteaddr;
proxysetheader Host $httphost;

server {
    listen      80;
    location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;

Thanks in advance.

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.

1 answer


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.

Submit an Answer