default domain for multiple domains

Support for webhosts that use CentOS
Post Reply
spykee
Posts: 2
Joined: 2011/01/03 14:50:39

default domain for multiple domains

Post by spykee » 2011/01/03 14:59:52

Hi all,

I managed to setup two sites on my local machine, both of them are working fine. Below are the conf files.

domain1

[code]
<VirtualHost *:80>
ServerAdmin me@nodomain.com
DocumentRoot "/var/www/dummydomain.com/httpdocs/"
ServerName dummydomain.com
ServerAlias www.dummydomain.com
ErrorLog "/var/www/dummydomain.com/logs/error.log"
CustomLog "/var/www/dummydomain.com/logs/access.log" common
ScriptAlias /cgi-bin/ "/var/www/dummydomain.com/cgi-bin/"

<Directory "/var/www/dummydomain.com/httpdocs/">
Options -Indexes FollowSymLinks +ExecCGI
DirectoryIndex index.php index.html
AllowOverride AuthConfig FileInfo
AddHandler php5-fastcgi .php
Action php5-fastcgi /cgi-bin/php.fcgi
Order allow,deny
Allow from all
</Directory>

</VirtualHost>
[/code]
domain2

[code]
<VirtualHost *:80>
ServerAdmin me@nodomain.com
DocumentRoot "/var/www/testonly.com/httpdocs/"
ServerName testonly.com
ServerAlias www.testonly.com
ErrorLog "/var/www/testonly.com/logs/error.log"
CustomLog "/var/www/testonly.com/logs/access.log" common
ScriptAlias /cgi-bin/ "/var/www/testonly.com/cgi-bin/"

<Directory "/var/www/testonly.com/httpdocs/">
Options -Indexes FollowSymLinks +ExecCGI
DirectoryIndex index.php index.html
AllowOverride AuthConfig FileInfo
AddHandler php5-fastcgi .php
Action php5-fastcgi /cgi-bin/php.fcgi
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
[/code]
httpd.conf

[code]
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /var/www/default/
ServerName testdomain123.net
ErrorLog /var/www/default/logs/error_log
CustomLog /var/www/default/logs/access_log common
</VirtualHost>
[/code]
However when I access the web server using the IP address, it goes to /var/www/dummydomain.com/httpdocs/ or domain1.
Should it be in /var/www/default/ ? Or how can I make it happen? I want to set a certain page if the server will be access using the IP address.

Thanks

[Moderator edit: Changed [i]quote[/i] to [i]code[/i] tags to preserve formatting. Fixed typo in Subject.]

hansolo
Posts: 231
Joined: 2010/01/13 11:17:42
Location: SI

default domain for multiple domains

Post by hansolo » 2011/01/04 20:24:53

Hi

Try reconfiguring [b]httpd.conf[/b] as to [url=https://www.centos.org/modules/newbb/viewtopic.php?topic_id=29195&forum=43&post_id=120889#forumpost120889]this[/url] configuration, mostly it's always a problem using [i][/i]

Then you can use:

[code]
<VirtualHost 123.123.456.78:80> <--- your IP address

[i]settings for the directory you want to show[/i]

</VirtualHost>
[/code]

Post Reply

Return to “CentOS 5 - Webhosting Support”