Apache virtual host not working correctly

Somehow my virtual host files do not work directly, I can’t understand why, I bet it’s just a mail function in my brain until the morning: p

Now I have TWO sites included via a symbolic link to sites available in the / etc / apache 2 / directory, for example:

0 Nov 21 12:24 000-default -> ../sites-available/default 0 Nov 21 14:52 001-site -> ../sites-available/site 

my VHosts files look like this:

Default

 <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName (the IP Address from my Server) ServerAlias (the 2nd IP Address from my Server) DocumentRoot /var/www/default <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/default> Options FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> 

SITE

 <VirtualHost *:80> ServerAdmin myname@example.de DocumentRoot /var/www/site/ ServerName jobbörse-köln.de ServerAlias www.example.de ww.example.de w.example.de <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/site> Options FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/site-error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/site-access.log combined </VirtualHost> 

Somehow, when I continue with "example.de", I get to the DEFAULT directory instead of the SITE directory. Even the log files:

 site-error.log site-access.log 

stay at 0 bytes ... what am I doing wrong? I bet it's something dumb and light ...

+6
source share
1 answer

You use port 80 by default to record the virtual host. Therefore, I hope you use NameVirtualHost *: 80 as a configuration.

in the configuration you used VirtualHost overlap on port 80, so the first takes precedence.

+7
source

Source: https://habr.com/ru/post/958647/


All Articles