Hi,
my question is pretty simple actually but haven't found a clear answer yet so...
Do I need a DNS server to host multiple domains on the same box?
I've always used Plesk and now I'm trying to do without it. So I have a bunch of questions but I'm testing everything on a virtual machine at home so this particular DNS stuff is giving me a hard time.
I would say that adding VirtualHost entries on my httpd.conf would be enough to support multiple domains.
VirtualHost myip:80
DocumentRoot /www/mydomain1
ServerName mydomain1.com
VirtualHost same_ip_as_before:80
DocumentRoot /www/mydomain2
ServerName mydomain2.com
VirtualHost same_ip_as_before:80
DocumentRoot /www/mydomain3
ServerName mydomain3.com
ANSWER:
uote:
wminside wrote:
Do I need a DNS server to host multiple domains on the same box?
But I haven't tested it yet on a regular box. Is this right? I so, why would someone need a DNS server?
In your case no, because you wrote Quote:
I mean, most of my domains are on Enom.com so I use their nameservers. I just have to enter my servers' ips on the Host Records tab.
and
Quote:
I would say that adding VirtualHost entries on my httpd.conf would be enough to support multiple domains.
you're right about this because you use DNS from your Enom provider.
Some quick guide of important things in httpd.conf don't forget to replace 111.222.333.444 with your IP:
Listen 80
ServerName 111.222.333.444
NameVirtualHost 111.222.333.444:80
and then Virtual Host configuration at the bottom:
ServerName www.example.com
DocumentRoot "/var/www/example.com/htdocs"
ScriptAlias /cgi-bin/ /var/www/example.com/cgi-bin/
# Alias /phpmyadmin/ /var/www/phpmyadmin/
Options -Indexes
AllowOverride All
Order Deny,Allow
Deny from all
Options -Indexes
AllowOverride All
Order allow,deny
Allow from all
Options -Indexes
AllowOverride All
Order allow,deny
Allow from all
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html\ HTTP/
RewriteRule ^(.*)index\.html$ http://www.example.com$1 [R=301,L]
ErrorLog /var/log/httpd/error_log
#CustomLog /var/log/httpd/www.example.com_access_log combined env=!gif-image
#AddType text/html .shtml
#AddHandler server-parsed .shtml
Simply copy this and change example.com with your domain names.
Should be working if you set DNS for domains to your IP.
No comments:
Post a Comment