我在ubuntu上做了一个虚拟主机,它将其重定向到HTTPS。虚拟主机不起作用。
这是虚拟主机设置:
<VirtualHost *:80>
ServerName xserver.dev
DocumentRoot /var/www/xserver/public
SetEnv APPLICATION_ENV "development"
<Directory /var/www/xserver/public>
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/xx-error.log
CustomLog ${APACHE_LOG_DIR}/xx-access.log combined
</VirtualHost>
我将其添加到/etc/hosts中127.0.0.1 xserver.dev
当我尝试访问xserver.dev时它将我重定向到https://xserver.dev和空白页
我也无法访问文件文件。在给定路径上可用
.dev
是Google运营的顶级域名。
自Chrome 63和Firefox 59以来,浏览器将.dev
URL重定向到HTTPS。
建议使用.test
,自1999年以来由互联网工程工作组保留(RFC2606(。
将虚拟主机更改为:
<VirtualHost *:80>
ServerName xserver.test
DocumentRoot /var/www/xserver/public
SetEnv APPLICATION_ENV "development"
<Directory /var/www/xserver/public>
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/xx-error.log
CustomLog ${APACHE_LOG_DIR}/xx-access.log combined
</VirtualHost>
和您的 /etc/hosts
to:
127.0.0.1 xserver.test
然后,访问您的网站:http://xserver.test