I am trying to get ghost to run from example.com/blog
instead of just example.com
I am now getting a ghost 404 on http://example.com/blog/
and the default nginx home page on http://example.com/
I used DO’s one click installer and had ghost running before I tried this. I have looked at all info I could find on DO and ghostforbeginners.com
This is what I did:
nano /etc/nginx/sites-available/ghost
changed the location /
to location /blog
here:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name http://example.com; # Replace with your domain
root /usr/share/nginx/html;
index index.html index.htm;
client_max_body_size 10G;
location /blog {
proxy_pass http://localhost:2368;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
}
}
Then saved it and nano /var/www/ghost/config.js
changed the production url be have http://example.com/blog/
production: {
url: 'http://example.com/blog/',
mail: {},
database: {
...
Then I restarted everything
sudo service nginx restart
These didn’t work or help me: https://www.ghostforbeginners.com/how-to-install-ghost-in-a-subdirectory/ and https://www.digitalocean.com/community/questions/adding-ghost-blog-to-existing-website and https://www.digitalocean.com/community/questions/how-to-put-ghost-blog-as-subdirectory-on-page
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!
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.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Hi @ac130nz
Try this server-block instead, just like the article on Ghost for Beginners: