系统:ubuntu 14.04作为VPS,apache 2.4.7
我有几个虚拟主机设置,听:80和:443端口。
如果我apache2ctl -S它显示不正确的虚拟主机作为端口80上的默认。事实上,如果我浏览到http://default.com ,我从另一个虚拟主机获取内容:一个Apache指定为默认,但shouldn (客户.com)。 我的设置有什么问题?
我启用的网站是:
default.com customer.com
apache2ctl -S
VirtualHost configuration: *:80 is a NameVirtualHost default server customer.com (/etc/apache2/sites-enabled/customer.com.conf:1) port 80 namevhost customer.com (/etc/apache2/sites-enabled/customer.com.conf:1) port 80 namevhost www.customer.com (/etc/apache2/sites-enabled/customer.com.conf:19) port 80 namevhost www.default.com (/etc/apache2/sites-enabled/default.com.conf:36) port 80 namevhost tools.default.com (/etc/apache2/sites-enabled/default.com.conf:41) port 80 namevhost phpmyadmin.default.com (/etc/apache2/sites-enabled/default.com.conf:57) *:443 is a NameVirtualHost default server default.com (/etc/apache2/sites-enabled/customer.com.conf:26) port 443 namevhost default.com (/etc/apache2/sites-enabled/customer.com.conf:26) port 443 namevhost default.com (/etc/apache2/sites-enabled/default.com.conf:1) port 443 namevhost www.default.com (/etc/apache2/sites-enabled/default.com.conf:31) port 443 namevhost default.com (/etc/apache2/sites-enabled/default.conf:26)
default.com Vhost
<VirtualHost *:443> ServerName default.com DocumentRoot /data/www/default.com/public <Directory /data/www/default.com/public> Require all granted </Directory> # SSL stuff ... ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/data/www/default.com/public/$1 </VirtualHost> <VirtualHost *:443> ServerName www.default.com RedirectMatch (.*) https://default.com$1 </VirtualHost> <VirtualHost *:80> ServerName www.default.com RedirectMatch (.*) https://default.com$1 </VirtualHost> <VirtualHost *:80> ServerName tools.default.com DocumentRoot /data/www/default.com/subdomains/tools/public ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/data/www/default.com/subdomains/tools/public/$1 <Directory /data/www/default.com/subdomains/tools/public> Require all granted </Directory> LogLevel error </VirtualHost> <VirtualHost *:80> ServerName phpmyadmin.default.com DocumentRoot /usr/share/phpmyadmin ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/usr/share/phpmyadmin/$1 <Directory /usr/share/phpmyadmin> AllowOverride All Require all granted </Directory> </VirtualHost>
Customer.com vhost
<VirtualHost *:80> ServerName customer.com DocumentRoot /data/www/customer.com/public <Directory /data/www/customer.com/public> Require all granted </Directory> ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9001/data/www/customer.com/public/$1 </VirtualHost> <VirtualHost *:80> ServerName www.customer.com RedirectMatch (.*) http://customer.com$1 </VirtualHost>
您没有非www的default.com条目
这应该被添加到default.comconfiguration中:
<VirtualHost *:80> ServerName default.com RedirectMatch (.*) https://default.com$1 </VirtualHost>