-
-
Save ErisDS/3ee9f27bcdb43522f0be to your computer and use it in GitHub Desktop.
Recommended nginx config for Ghost(Pro) subdirectory proxy. SSL is required.
This file contains 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 { | |
listen 80; | |
server_name <yourdomain.com>; # Replace with your domain | |
# include any global or shared config | |
# include /etc/nginx/conf/your-config-here.conf; | |
# redirect to SSL | |
return 301 https://$host$request_uri; | |
} | |
server { | |
listen 443 ssl default_server; | |
server_name <yourdomain.com>; # Replace with your domain | |
# Your SSL Certificate details. Replace with your own SSL setup | |
# ssl_certificate /path/to/cert; | |
# ssl_certificate_key /path/to/key; | |
location /blog/ { | |
client_max_body_size 10G; # Required for uploading large files | |
# Proxy Settings, all required | |
resolver 1.1.1.1 8.8.8.8; # Prevent caching the upstream IP - use preferred DNS resolvers or leave as default | |
set $ghost_url https://<yoursubdomain>.ghost.io; # Replace with your subdomain | |
proxy_pass $ghost_url; # Variable name must match line above, use of variable required for resolver | |
proxy_redirect off; | |
proxy_set_header Host <yoursubdomain>.ghost.io; # Replace with your subdomain | |
proxy_set_header X-Forwarded-Host <yourdomain.com>; # Replace with your domain | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment