A
A
Axwellweb2019-02-01 15:56:32
Apache HTTP Server
Axwellweb, 2019-02-01 15:56:32

Why does Apache2 open only one site at all addresses?

Good afternoon! There is a server with 3 sites, one of which is the main stub for the server, which is displayed when you access the server by IP address.
Stub Settings

<VirtualHost *:80>
  ServerName 123.123.123.123 #внешний ip сервера
  ServerAdmin [email protected]
  DocumentRoot /var/www/default
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Site settings 1:
<VirtualHost *:80>
  ServerName dom1.site.ru
  ServerAdmin [email protected]
  DocumentRoot /var/www/site1
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Site settings 2:
<VirtualHost *:80>
  ServerName dom2.site.ru
  ServerAdmin [email protected]
  DocumentRoot /var/www/site2
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Tell me what's wrong? Because when accessing literal addresses and IP, a stub opens.
The subdomains dom1.site.ru and dom2.site.ru are bound by A record on the server IP
. At the same time, it is necessary that the sites also open on the internal IP ... But, as I see it, it is necessary to hang all the sites on different ports. Is it true or is there an easier way?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question