Configure Apache proxy for Ghost on cPanel

Updated on Jul 13, 2018

If you have installed Ghost via Softaculous in the past, most likely your Ghost URL will look like this: https://blog.example.com:62227. The numbers after your domain name represent the Node port which services all requests to your Ghost blog. As Node is a standalone service, it requires a dedicated port different than the standard port 80 used by the Web Server.

Still, this might be very inconvenient for your visitors, and you might want to have your Ghost blog accessible via the standard port 80. To achieve this, you will need to perform a few easy steps on your server to configure the Apache proxy to redirect all requests to your custom Ghost blog installation port.

We can help

In case you are hosting your Ghost blog on our Ghost Hosting Package, please contact our support team, and we will set this for you in just a few minutes. If you are managing your server on your own, please follow the steps below.

To have your Ghost blog accessed without a port number in the URL, you need to:

step

Create a userdata Directory

First, you will need to create a folder under the "userdata" directory of your Apache web server. That can be done by executing:

mkdir -p /usr/local/apache/conf/userdata/std/2/USERNAME/DOMAIN/

Please replace "USERNAME" with your actual cPanel username and "USERNAME" with your actual domain or subdomain under which Ghost is installed.

step

Create a Proxy Config File

When the needed folders are created, navigate to your domain userdata directory and create a text file called ghost.conf. The content of the ghost.conf file should be:

ProxyPass / http://127.0.0.1: 62227/
ProxyPassReverse / http://127.0.0.1: 62227/

Please replace the port number 62227 with your actual Ghost port number provided to you during the installation process. When you are ready, save the file and exit the text editor program.

step

Include the Config File in httpd.conf

Next, you will need to edit your Apache httpd.conf. The exact path to the file is:

/etc/httpd/conf/httpd.conf

You can open the httpd.conf via your favorite text editor and you should search for your domain or subdomain vhost which should look like:

<VirtualHost 192.168.1.30:80>
    ServerName blog.example.com
    ServerAlias www.blog.example.com
.........
    # To customize this VirtualHost use an include file at the following location
    # Include "/usr/local/apache/conf/userdata/std/2/example/blog.example.com/*.conf"
</VirtualHost>

Here you should uncomment the last line which includes all .conf files from the directory you have just created. You can do this by removing the '#' sign at the beginning of the line. When you are done, save the file and exit the text editor program.

Now you should restart your Apache web service by executing:

/etc/init.d/httpd restart

After the Apache restart, all requests should be automatically handled by the Apache and redirected internally to the Node custom port. Now you can conveniently access your Ghost blog directly via your URL without the need to include the port number.

If you experienced any difficulties during the process, please contact our support team, and we will configure your Ghost blog for you.

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