Created
August 21, 2020 12:52
-
-
Save gp187/a0e1bd711309714ecf2f4414c42b30e9 to your computer and use it in GitHub Desktop.
Nginx website with Ghost blog in a subdirectory sharing a single SSL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
root /var/www/html; | |
index index.html index.htm index.nginx-debian.html; | |
server_name domain.tld www.domain.tld; | |
location ~ \.php$ { | |
include snippets/fastcgi-php.conf; | |
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; | |
} | |
location / { | |
try_files $uri $uri.html $uri/ =404; | |
} | |
location ^~ /subdirectory { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-NginX-Proxy true; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_pass http://localhost:2368; | |
proxy_redirect off; | |
} | |
listen 443 ssl; # managed by Certbot | |
ssl_certificate /etc/letsencrypt/live/snpranav.com/fullchain.pem; # managed by Certbot | |
ssl_certificate_key /etc/letsencrypt/live/snpranav.com/privkey.pem; # managed by Certbot | |
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot | |
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment