Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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    @
share|improve this question

1 Answer 1

up vote 0 down vote accepted

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>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.