How to change your Ghost Port

Updated on Jul 13, 2018

In this tutorial we will show you how to change your Ghost port. This can be useful if you would like to run your Ghost blog on the standard HTTP port 80 or if you would like to configure it on a different port and leave your main web service handle the request on port 80.

If you have followed our "How to Manually install Ghost" your instance of Ghost should be located under:

/var/www/ghost/

In case you have manually installed Ghost in the past, please enter your Ghost directory and open the config.js file with your favorite text editor.

Locate the Production configuration section which should start around the 43th line of the config.js file with ### Production tag and change this line:

// Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
            port: '80'

Please change the number in the quotes with the desired port number for your Ghost instance. When you are ready save your changes and exit the text editor. To apply the changes you will need to restart your Ghost. In case you have followed our installation tutorial or you are using Forever you can restart the Ghost process by simply killing the current execution -- it will be automatically restarted by Forever.

To view the process simply use the following command:

[root@ghost ghost]# ps auxf | grep ghost
This will give you the process running Ghost:
root      4200  0.3  7.6 1008668 78240 ?       Sl   13:00   0:06  \_ /usr/local/bin/node /var/www/ghost/index.js

The process ID is the first number after the process user -- in this example the process ID is 4200. To stop the process use the process ID with the following command:

[root@ghost ghost]# kill -9 4200

Note

Remember to change the process ID with your actual process ID. Forever should automatically restart your Ghost process. In case you do not use Forever you will need to manually restart your Ghost Node.js instance.

With all of this completed, you now know how to change the port of your Ghost Installation.

On this page...

    Ghost Hosting

    • Free Ghost Installation
    • 24/7 Ghost Support
    • Hack-free Protection
    • Fast SSD Storage
    • Free Domain Transfer
    • Free Ghost Transfer
    • Immediate Activation
    • Free Cloudflare CDN
    View More