By Will Robert
Hi all,
I have a server with two domains pointed at it, serving two different websites. The first website is a simple Ghost blog, the second website is a home page with a subdirectory /log that is another Ghost blog.
The first installation works just fine. MySite.com leads to the blog, everything works as expected.
The second one is the issue. MyOtherSite.com leads to a landing page, and then MyOtherSite.com/log should lead you to the blog, but it’s showing a default nginx 403 page.
My sites-enabled looks like this:
server {
listen 80;
listen [::]:80;
server_name MyOtherSite.com;
root /var/www/MyOtherSite.com/log/system/nginx-root; # Used for acme.sh SSL verification (https://acme.sh)
location ^~ / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:2369;
proxy_redirect off;
}
location ^~ /log {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:2369;
proxy_redirect off;
}
location ~ /.well-known {
allow all;
}
client_max_body_size 50m;
}
The layout of the MyOtherSite.com is as follows:
-rw-r--r-- 1 www-data www-data 615 Sep 26 03:41 _index.html
-rw-r--r-- 1 root root 250 Sep 27 07:52 index.html
drwxr-xr-x 4 phantom phantom 4096 Sep 28 08:49 log
-rw-r--r-- 1 root root 190 Sep 27 07:54 terrarium.css
Where phantom is my “ghost” user.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi @willrobert,
First, should the proxy_pass lead to the same port? Is it possible for two ghost instances to use the same port, in your case 2369?
Additionally, locations are evaluated in this order:
location = /path/file.ext {} Exact matchlocation ^~ /path/ {} Priority prefix match -> longest firstlocation ~ /Paths?/ {} (case-sensitive regexp) and location ~* /paths?/ {} (case-insensitive regexp) -> first matchlocation /path/ {} Prefix match -> longest firstGet paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.