Report this

What is the reason for this report?

Change Ghost location on Nginx

Posted on November 1, 2014

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

V1ncam



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.

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?

rtmp_auto_push on; rtmp_auto_push_reconnect 1s; rtmp_socket_dir /var/sock;

rtmp {

server { listen 1935; chunk_size 8192;

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

application restream { live on; allow play all; record off; allow publish 127.0.0.1; allow publish all; push rtmp://restream/a.rtmp.youtube.com/live2/w8r7-xxx-8kxv-xxxx; } } }

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 my-ghost-blog.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;
    } 
}

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: 'http://my-ghost-blog.com/blog',
        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.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.