0

I'm trying to set up Ghost the blogging platform on my CentOS (6.5, x64) server with Apache and... I think I mixed together my domain (www.example.com) with the Ghost subdomain (blog.example.com). I hope the main page would be a static html page. So here's my problem:

  • example.com/ -> (redirected to www.example.com) is going to GHOST ----- should go to "Welcome Apache"
  • www.example.com/ -> is going to GHOST ----- should go to "Welcome Apache"
  • blog.example.com/ -> is going to GHOST and it's correct

I found a similar thread here:

https://ghost.org/forum/using-ghost/3457-newbie-issue-with-subdomain/

The solution there is based on nginx and Ubuntu, I guess. Could anyone help me walk through the settings with Apache? Thanks! I can't do it like http://content.websitegear.com/article/subdomain_setup.htm because Ghost is a nodejs app with no DocumentRoot to set, which listens port 80 and links it with port 2368.

Here are some snippets that would help understand my situation (I've uncomment the '#NameVirtualHost *:80' in /etc/httpd/conf/httpd.conf):

vim /etc/httpd/conf.d/ghost.conf

<VirtualHost *:80>

ServerName blog.example.com
ProxyRequests Off
ProxyPreserveHost On

AddDefaultCharset Off
Order deny,allow
Allow from all

ProxyPass / http://127.0.0.1:2368/
ProxyPassReverse / http://127.0.0.1:2368/

</VirtualHost>

and here's my DNS zone file:

A (Host)
Host Points To
@    M.Y.I.P

CName (Alias)
Host Points To
blog   @
www    @
Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
leoce
  • 103
  • 2
  • 5

1 Answers1

0

Problem solved.

rm /etc/httpd/conf.d/ghost.conf

vim /etc/httpd/conf/httpd.conf
<VirtualHost *:80>
    ServerName blog.example.com

    ProxyPreserveHost on

    ProxyPass / http://127.0.0.1:2368/

</VirtualHost>

<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com
    ProxyRequests off

    DocumentRoot /var/www/html

</VirtualHost>
leoce
  • 103
  • 2
  • 5