Answer the question
In order to leave comments, you need to log in
Running several name-based web sites on a single IP address
I'm trying to make a division by site, on the same IP.
It is not possible to do something that, when going through a direct IP, I would throw it into one folder, and when going through a domain, into another.
How to implement it?
All virtual host settings in " /etc/apache2/sites-available/default " file ( In one heap just for testing ):
<VirtualHost *:80>
DocumentRoot /var/www/testsite.local/htdocs
# Other directives here
</VirtualHost>
<VirtualHost site.com:80>
DocumentRoot /var/www/site.com
ServerName site.com
# Other directives here
</VirtualHost>
Answer the question
In order to leave comments, you need to log in
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/testsite.local/htdocs
ServerName testsite.local
# Other directives here
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/site.com
ServerName site.com
# Other directives here
</VirtualHost>
<VirtualHost 127.0.0.1:80>
DocumentRoot "/var/www/default"
ServerName "default"
ServerAlias "default"
</VirtualHost>
<VirtualHost 127.0.0.1:80>
DocumentRoot "/var/www/site.com"
ServerName "site.com"
ServerAlias "www.site.com"
</VirtualHost>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question