我在Ubuntu18.04上用Apache2拔头发。
我有几个指向Vhosts的域,它们似乎可以工作,但由于某些原因,直接浏览到IP时,如果只是转发到一个vhost,而不是/var/www/html目录的根目录。怎么一回事?这在Centos上有效,但在Ubuntu上不起作用。
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
ServerAdmin webmaster@localhost
ServerName domain.com
ServerAlias domain.com
DocumentRoot /var/www/html/domain.com/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined发布于 2019-11-24 17:40:25
站点中是否启用了1000-default.conf?如果没有,可以创建它并将第一个虚拟移动到其中:
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm现在为您的其他虚拟化创建一个.conf,其中包含10-this-域和20-那个域之类的升序文件。
在apache2.conf中,您可能应该使用以下行
IncludeOptional sites-enabled/*.conf启用目录站点保存虚拟化的所有主机文件。
在Ubuntu上开箱即用,我只需将新主机放到启用了的站点中即可。
https://serverfault.com/questions/993108
复制相似问题