Jump to content

Virtual Host issue...


spy_X

Recommended Posts

Hey all,

I am having a problem with my virtual host with apache.  I do think i have everything right
and is working as far as the virtual setup goes.. (port 80 is blocked by ISP, using 81)
Also, im using Apache, 1.3.37.

example:

http://webmail.domain.net:81  -->  goes right to /var/www/htdocs/webmail
http://www.domain.net:81 -->  goes right to /var/ww/htdocs (main page)

but the problem is... when i use the following,

http://domain.net:81 -->  it goes right to the same page as webmail.

Im not sure what i can do to fix it.
I have included parts of the httpd.conf, can someone
please check it over and see if i made any typo's that would
stop the http://domain.net/ from going to the httpd root dir.

Thanks in advance!!

----------------cut--------------
### Section 1: Global Environment
ServerType standalone
ServerRoot "/usr"
PidFile /var/run/httpd.pid
ScoreBoardFile /var/run/httpd.scoreboard
TimeOut 300
KeepAlive on
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MinSpareServers 5
MaxSpareServers 10
StartServers 5
MaxClients 150
MaxRequestsPerChild 0
Listen 81

### Section 2: 'Main' server configuration
Port 81
User nobody
Group nobody
ServerAdmin [email protected]
ServerName www.domain.net
DocumentRoot "/var/www/htdocs"
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory "/var/www/htdocs">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
<IfModule mod_userdir.c>
    UserDir public_html
</IfModule>
<Directory /home/*/public_html>
    AllowOverride FileInfo AuthConfig Limit
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    <Limit GET POST OPTIONS PROPFIND>
        Order allow,deny
        Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS PROPFIND>
        Order deny,allow
        Deny from all
    </LimitExcept>
</Directory>
<IfModule mod_dir.c>
    DirectoryIndex index.html index.htm index.shtml index.shtm index.php
</IfModule>
    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
    <Directory "/var/www/cgi-bin">
        AllowOverride None
        Options None
        Order allow,deny
        Allow from all
    </Directory>

### Section 3: Virtual Hosts
NameVirtualHost *:81

<VirtualHost *>
ServerName webmail.domain.net
DocumentRoot /var/www/htdocs/webmail
</VirtualHost>

<VirtualHost *>
ServerName www.domain.net
DocumentRoot /var/www/htdocs/
</VirtualHost>
-----------------/cut----------------------------
Link to comment
https://forums.phpfreaks.com/topic/27810-virtual-host-issue/
Share on other sites

It's using the webmail domain because it becomes the "default domain". The default domain is the first one specified.

Try changing it to:

--------------------------------

NameVirtualHost *:81

<VirtualHost *>
ServerName www.domain.net
DocumentRoot /var/www/htdocs/
</VirtualHost>

<VirtualHost *>
ServerName webmail.domain.net
DocumentRoot /var/www/htdocs/webmail
</VirtualHost>

--------------------------------

Putting the www.domain.net virtualhost first, this would make it the default domain.

You could also add a virtualhost for servername domain.net, and it would use that, I would suggest changing the www.domain.net to be the default domain
Link to comment
https://forums.phpfreaks.com/topic/27810-virtual-host-issue/#findComment-127452
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.