Moving a 1-click ghost installation to a subdirectory getting 404 error.

October 12, 2018 830 views
Nginx Ghost MySQL

Hello,

I am trying to run a ghost blog in a subdirectory(/blog) instead of the direct domain link. I have changed the location from /etc/nginx/sites-available/site_name.conf

server {
    listen 80;
    listen [::]:80;

    server_name domain.com;
    root /var/www/ghost/system/nginx-root;

    location ^~ /blog {
        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:2368;

    }

    location ~ /.well-known {
        allow all;
    }

    client_max_body_size 50m;
}


and changed the config.production.json file to:

 production: {
        url: 'http://example.com/blog/',
        mail: {},
        database: {
…

and then I restarted the server

sudo service nginx restart

it has been moved to /blog but it doesn’t show me the posts, images, footer, admin page /ghost link etc., perhaps it’s about MySql but I couldn’t find a way to solve it, may someone direct me how can I solve it?

Thank you,

3 comments
  • Try removing the / at the end of the url in ghost’s config file. You can then cd to the gost dir and issue ghost restart. If this doesn’t help i’ll spin'up a ghost instance and see if i can figure it out.

  • solved in seconds, thank you so much :)

  • Yup i can confirm this as i’ve just finished with my set'up. :D

1 Answer
zacharybk MOD October 15, 2018
Accepted Answer

This question was answered by @X40C:

Try removing the / at the end of the url in ghost’s config file. You can then cd to the gost dir and issue ghost restart. If this doesn’t help i’ll spin'up a ghost instance and see if i can figure it out.

View the original comment

Have another answer? Share your knowledge.