php - In Apache Server,does making the virtualhost enabled mean the 'Mainhost' is disabled? -


i'm configging apache server. in httpd.conf, set documentroot below:

documentroot "d:/phpwwwroot" 

and set directory node below:

<directory "d:/phpwwwroot">     options indexes followsymlinks     allowoverride    order allow,deny     allow </directory> 

for moment, haven't enabled virtual host. , visit url: http://localhost:8080/, ok.

next, tried set virtual host.i uncommented out virtual hosts. below:

# virtual hosts include conf/extra/httpd-vhosts.conf 

and httpd-vhosts.conf below:

namevirtualhost *:8080  <virtualhost *:8080>     servername www.testphp1.com     documentroot "d:\virtualroot"     directoryindex index.shtml index.html index.htm index.php       <directory "d:\virtualroot">           options indexes followsymlinks          allowoverride           order allow,deny           allow       </directory>   </virtualhost>  <virtualhost *:8080>     servername www.testphp2.com     documentroot "d:\virtualroot1"     directoryindex index.shtml index.html index.htm index.php       <directory "d:\virtualroot1">           options indexes followsymlinks          allowoverride           order allow,deny           allow       </directory>   </virtualhost> 

and edit hosts file correct mapping, should know mean:

127.0.0.1 www.testphp1.com 127.0.0.1 www.testphp2.com 

next restart apache server, visit below urls:

http://www.testphp1.com:8080/ http://www.testphp2.com:8080/ 

everything ok. mapped right folder.

a new question raised, when try visit http://localhost:8080/, come first virtual host--www.testphp1.com. means page shows www.testphp1.com shows.

it seems "main host" doesn't work.

how happen? how fix

it's same situation when you're using ip access server. it'll show first active website uses ip (localhost treated ip here). can fix defining main website first.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -