mercredi 22 août 2018

apache 2.4 doesn't work one of two virtual hosts

I have two vhosts test.com and example.com on one machine. The test.com woks fine, but example.com server redirect to world wide web. Configuration other vhosts indentical, code too. Syntax or semantics errors are not found. Apache works fine. No messages in error.log. I don't understand why one vhost works and second vhost didn't. Files test.com.conf and example.com.conf from /etc/apache2/sites-available:

<VirtualHost *:80>
DocumentRoot /var/www/test.com/public_html
ServerName test.com
ServerAlias www.test.com
ServerAdmin anymail@gmail.com

ErrorLog /var/www/test.com/log/error.log
CustomLog /var/www/test.com/log/access.log combined
</VirtualHost>
########################################################################
<VirtualHost *:80>
DocumentRoot /var/www/example.com/public_html
ServerName example.com
ServerAlias www.example.com
ServerAdmin anymail@yahoo.com

ErrorLog /var/www/example.com/log/error.log
CustomLog /var/www/example.com/log/access.log combined
</VirtualHost>

apache2.conf:

DefaultRuntimeDir ${APACHE_RUN_DIR}
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>
<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>
<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
AccessFileName .htaccess

<FilesMatch "^\.ht">
    Require all denied
</FilesMatch>

<FilesMatch "\.php$">
    SetHandler application/x-httpd-php
</FilesMatch>

<FilesMatch "^\.phps$">
    SetHandler application/x-httpd-php-source
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

IncludeOptional conf-enabled/*.conf

IncludeOptional sites-enabled/*.conf

/etc/hosts:

127.0.0.1   test.com
127.0.0.1   example.com
127.0.0.1   localhost

diff from /test.com/.../index.php and example.com/.../index.php

9c9
<       echo "Welcome to example.com";
---
>       echo "Welcome to test.com";




Aucun commentaire:

Enregistrer un commentaire