Change Ghost location on Nginx

Posted November 1, 2014 4.8k views

Hi good people of Digital Ocean,

I installed the Ghost image. Now I want to change the path for Ghost (“<domain>”/blog). How do I do this?

PS: In Nginx


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.

Submit an Answer
2 answers

To serve Ghost from a subfolder instead of the root of the domain, you’ll need to edit /etc/nginx/sites-enabled/ghost And simply change the location block like:

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    server_name; # 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;

And then restart Nginx: service nginx restart

Next you’ll also need to update Ghost’s configuration file as well. Edit the URL in /var/www/ghost/config.js

config = {
    // ### Production
    // When running Ghost in the wild, use the production environment
    // Configure your URL and mail settings here
    production: {
        url: '',
        mail: {},

And restart Ghost with service ghost restart

You should be all set to go! You can now service files as normal from the Nginx document root as well.

Greetings and Cheers to all.

I have built an RTMP Nginx server. I am pushing from my 4G encoder to the server over a public network. The issue is it didn’t auto-reconnect to the server when the network is available after a lost signal. The configuration I used is below. Can any anyone help to improve my script and if there is anything missing?

rtmpautopush on;
rtmpautopushreconnect 1s;
socket_dir /var/sock;

rtmp {

server {
listen 1935;
chunk_size 8192;

application live {
live on;
allow play all;
record off;
allow publish;
allow publish all;

application restream {
live on;
allow play all;
record off;
allow publish;
allow publish all;
push rtmp://restream/;