M
M
mihasyo2014-05-19 15:46:03
Apache HTTP Server
mihasyo, 2014-05-19 15:46:03

Two sites on one apache server

Good day!
There is a server on ubuntu 12.04 with apache and webmin installed.
Two sites are required:
1. Must be visible only from the local network, it is already implemented:
ServerName local
DocumentRoot /var/www
Order Deny,Allow
Deny from all
Allow from 192.168.1.2/24
2. Must be visible from outside, but only from the Internet for some reason directs to the first.
DocumentRoot /var/www/inet
ServerName inet
But for some reason, when I log in from the outside (I just enter the external IP), it redirects to the one that looks into the local network.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor, 2014-05-19
@merryjane

Run the apachectl -S command . It will show you which virtual hosts you currently have configured. And most importantly, which of the hosts is default.
The default host is the host that will be given to the request that comes to the server and does not fall into one of the virtual hosts (the ServerName does not match), as in your case.
How to fix:
1 way. In the config of the desired virtual host, add ServerAlias ​​with an additional domain name. For example, as in your case:
ServerAlias ​​external_IP_server.
2 way. Add to the name of the virtual host configuration file, which must be default, leading zero so that the file is the first in the list of configs.
I also recommend making the DocumentRoot site directories at the same level, and not nested into each other.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question