How To Proxy Port 80 to 2368 For Ghost With Apache


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 Apache to proxy all requests for port 80 to 2368. So to start, make sure you are in your root user, install Apache with one of the following commands, depending on what operating system you are running:

CentOS
yum install -y httpd
Ubuntu
apt-get install -y apache2

Create a new file in the following directories called yoursite.conf

CentOS
vi /etc/httpd/conf.d/yoursite.conf
Ubuntu
vi /etc/apache2/sites-enabled/yoursite.conf

Add the following into these conf files change the urls to your website

NameVirtualHost *:80 
<VirtualHost *:80> 
    ServerName your-url.com 
    ServerAlias www.your-url.com 
    ProxyRequests off 
    ProxyPass / http://127.0.0.1:2368/ 
    ProxyPassReverse / http://127.0.0.1:2368/     
</VirtualHost>

Now restart Apache

CentOS
/usr/sbin/setsebool httpd_can_network_connect true sudo service httpd restart
Ubuntu
sudo a2enmod proxy proxy_http && sudo service apache2 restart

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