Eu tenho um servidor Linux com o Debian GNU / Linux 9 (stretch) e o Apache / 2.4.25 (Debian) instalado. Eu quero hospedar vários sites no meu servidor. Por exemplo, um wesbites principais e 2-3 sites menores para os amigos. Também quero que uma página padrão seja exibida quando uma solicitação chegar ao servidor da Web que não está configurado no VHosts (por exemplo, de IP-Address). Por exemplo, Welcome on bla bla bla.
Gostaria de mencionar que, após cada alteração, eu recarreguei o servidor da Web e todas as permissões de arquivo estão corretas.
Minhas configurações:
habilitado para sites:
000-default.conf:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName www.example.com
ServerAdmin [email protected]
DocumentRoot /websites/www/
<Directory /websites/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
openair-seuzach.ch.conf:
<VirtualHost openair-seuzach.ch:80>
ServerName openair-seuzach.ch
ServerAdmin [email protected]
DocumentRoot /websites/openair-seuzach.ch/
<Directory /websites/openair-seuzach.ch/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
</VirtualHost>
vaorra.net.conf:
<VirtualHost vaorra.net:80>
ServerName vaorra.net
ServerAdmin [email protected]
DocumentRoot /websites/vaorra.net/
<Directory /websites/vaorra.net/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
</VirtualHost>
Meu servidor está sendo executado quando você deseja testá-lo por conta própria: link - > Deve vir "Em breve" link - > Deve vir "Wartung!"
e quando você entra no link também aparece "Wartung!" mas com este domínio eu quero que o site VHost 000-Default seja exibido e não o site do VHost openair-seuzach.
Meu arquivo 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
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</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
Include generic snippets of statements
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf
saída apachectl -S:
VirtualHost configuration:
149.202.219.157:80 is a NameVirtualHost
default server openair-seuzach.ch (/etc/apache2/sites-enabled/openair- seuzach.ch.conf:1)
port 80 namevhost openair-seuzach.ch (/etc/apache2/sites-enabled/openair-s euzach.ch.conf:1)
port 80 namevhost vaorra.net (/etc/apache2/sites-enabled/vaorra.net.conf:1)
127.0.1.1:80 vaorra.net (/etc/apache2/sites-enabled/vaorra.net.conf:1)
*:80 www.example.com (/etc/apache2/sites-enabled/000-default.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33
O nome do servidor no arquivo 000-default.conf que eu inseri é dessa postagem do Stackoverflow: link
Eu fiz a mesma pergunta no Stackoverflow e o dito eu deveria usar um fictício ServerName.
Obrigado!