Forum Moderators: phranque
Do I need to make www a subdomain?
Right now I have the virtual server set up like this.
ServerName example.com
ServerAlias 63.x.x.x www.example.com
Yes and no. What you have there will always use that vhost container when a request comes in for any of the three hosts. However, the proper configuration would be more along the lines of
<VirtualHost 63.x.x.x:80>
ServerName www.example.com:80
RedirectMatch permanent (.*) http://example.com$1
</VirtualHost>
<VirtualHost 63.x.x.x:80>
ServerName example.com:80
# rest of your directives here
</VirtualHost>
If you don't have access to your httpd.conf you can get the same effect using mod_rewrite. Their has been plenty of discussion in regards to the "how-to" do so in the Apache Forum here so a quick search should get you started.
Also, I am trying to set up multiple domains and make it so that they access phpMyAdmin through sql.expample.com. All domains lead to the same phpmyadmin, but with there respective domain names they have.
For example:
sql.example1.com
sql.example2.com
sql.example3.com
Will all lead to the same phpmyadmin folder. Right now I have those all using serveralias to accomplish and have them set up in bind.
As far as your second question here, are you saying that you have the same ServerAlias entry in more than one VirtualHost container?
<VirtualHost 63.x.x.x:80>
ServerName www.example.com:80
RedirectMatch permanent (.*) http://example.net$1
</VirtualHost>
<VirtualHost 63.x.x.x:80>
ServerName example.com:80
DocumentRoot /var/www/html
</VirtualHost>
<VirtualHost 63.x.x.x>
DocumentRoot /home/phpMyAdmin
ServerName sql.example.com
ServerAlias 63.x.x.x sql.example1.com
ServerAlias 63.x.x.x sql.example2.com
</VirtualHost>
As a side note, I have am new to a lot of this. This is actually my first adventure into web servers. I have all this running on a centos4.6 server with a webmin control panel, bind, mysql, and apache.
Also, while most people can can do www.example.com and it will redirect them properly to example.com but some people they can not use the www part or else it gives server not found. Is this something that takes a little bit of time before it's 100% or did I set something up wrong with my named server.
Also, while most people can can do www.example.com and it will redirect them properly to example.com but some people they can not use the www part or else it gives server not found. Is this something that takes a little bit of time before it's 100% or did I set something up wrong with my named server.
That's likely a DNS propagation delay issue, and should resolve over time. In most cases, DNS updates for modern ISPs take only a few hours. If the ISP is in an economically-disadvantaged country and is using old equipment or has it misconfigured, it might take many days to update. I've also seen some corporate networks take up to a week to update... not sure why.
Jim
<VirtualHost 63.x.x.x>
DocumentRoot /home/phpMyAdmin
ServerName sql.example.com
ServerAlias sql.example?.com
</VirtualHost>