I am trying to set up a staging server to run as a sub-domain of my production server and I'm running into a small problem.
I have my production server hosted on a RackSpace virtual machine. I cloned this machine to use as my staging server. I also added
A records to direct the sub-domain address to this new virtual machine.
I want to be able to access this staging server by typing
staging.domain.com, but that currently doesn't work. The workaround that I've found to work is typing
www.staging.domain.com. Note the extra
www in front of the sub-domain.
My directory structure is such that in my project directory I have a
public_html directory (which obviously houses the publicly viewable files) and a
private (which houses more of the back-end code). I want to have Apache serve
/var/www/staging.domain.com/public_html/index.php as the default file when I visit
As stated, I am currently only able to get what I want by visiting
www.staging.domain.com. When I visit
staging.domain.com I am redirected to
My httpd.conf is set up as follows (I am definitely not an expert in configuration of this file):
<VirtualHost *:80> # General Server Setup ServerAdmin email@example.com ServerName www.staging.domain.com ServerAlias staging.domain.com # Indexes + Directory Root DirectoryIndex index.php index.html DocumentRoot /var/www/staging.domain.com/public_html <Directory /var/www/staging.domain.com/public_html> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
I am pretty sure that the redirect I spoke of earlier is happening because of my specified
DocumentRoot in this file.
Also, I have tried many different combinations of
A records trying to get this to work, but I'm open to any other suggestions you might have.
I don't have anything specified for my
.htaccess file, so that shouldn't be effecting anything.
My current DNS record for this server are:
Type Name Content TTL A staging.domain.com XX.XX.XX.XX(server IP) 300 A www.staging.domain.com XX.XX.XX.XX(server IP) 300
There is really no additional information that I've configured that I can think of to share with you. If you can think of anything just ask.