【发布时间】:2020-11-28 20:17:55
【问题描述】:
我将 WSL1 更新为 WSL2 并安装
ubuntu 20.04, Apache2 和 php8
现在访问 localhost 将显示 Apache2 Ubuntu 默认页面
接下来我在/etc/apache2/sites-available/items.test.conf 上创建一个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 items.test
ServerAdmin admin@items.test
DocumentRoot /mnt/c/www/path/to/public
<Directory /mnt/c/www/path/to/public/>
Options Indexes FollowSymLinks
AllowOverride 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>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
运行 sudo a2ensite items.test.conf 和 sudo service apache2 reload。接下来用管理员用记事本打开host,并添加127.0.0.1 items.test
本地访问网站items.test给我这个消息
无法访问此网站
我错过了什么,花了 24 小时调整但没有运气
【问题讨论】:
标签: windows-10 apache2 windows-subsystem-for-linux