How to Proxy Port 80 to 2368 for Ghost with Nginx

Post cover image

If you followed one of our posts on How To Install Ghost, we highly suggest going through this post right after installing Ghost so that your Ghost blog is accessible on port 80 instead of 2368. We will accomplish this by using Nginx to proxy all requests for port 80 to 2368. So to start, install Nginx with one of the following commands, depending on what operating system you are running:


For CentOS the first thing you will need to do is create a Nginx yum repository:

vim /etc/yum.repos.d/nginx.repo

and then paste the following into that file:

name=nginx repo baseurl=$releasever/$basearch/ 

Now that yum knows where to download Nginx you can install it with:

sudo yum install nginx -y 
sudo service nginx start 
sudo chkconfig nginx on


sudo apt-get install nginx -y

With Nginx installed, we now need to tell Nginx that Ghost is ready for requests on port 2368. New Nginx configuration files can be added into /etc/nginx/conf.d/ (CentOS) or /etc/nginx/sites-enabled (Ubuntu). We would recommend creating your configuration file in this directory and naming it something meaningful, like: your-domain-name.conf. Once you have created your new Nginx conf file place the following into your file, replacing with your domain name:

server {
    listen 80;
    location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;

If you find sample Nginx configuration files found in /etc/nginx/conf.d/ or /etc/nginx/sites-enabled/, I would recommend deleting them.

rm /etc/nginx/sites-available/default
rm /etc/nginx/sites-enabled/default
rm /etc/nginx/conf.d/default

Now restart Nginx to make your changes take affect:

CentOS and Ubuntu

sudo service nginx restart

Your Ghost blog is now reachable via your domain name, on port 80, through Nginx to port 2368.

Next Steps:

Keep Ghost running with PM2
Keep Ghost running in the background and on startup using PM2

Learn Ghost from the Ground Up
Head to "Ghost for Beginners" to learn everything you need to know about learning and customizing Ghost

Find the Perfect Ghost Theme
Go to our Ghost themes section of this site to browse all of your Ghost theme options in one place.