F
F
Flaker2013-12-04 20:09:47
Apache HTTP Server
Flaker, 2013-12-04 20:09:47

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

4 answer(s)
X
xaker1, 2013-12-04
@Flaker

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>

When entering via IP, the first VirtualHost, EMNIP, should open.
And you don’t need to register the domain in it, IP:port is registered there.

E
Eugene, 2013-12-04
@Nc_Soft

<VirtualHost site.com:80>
there ip:port

E
Eugene, 2013-12-04
@Nc_Soft

<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>

J
Jonh Doe, 2013-12-04
@CodeByZen

Here you can read iteye.ru/1714/install-web-server-debian-apache-php...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question