use*_*015 0 apache ubuntu-16.04
我有一个 index.html 文件 \var\www\html
我的 /etc/apache2/sites-available/000-default.conf 是:
<VirtualHost *:80>
Servername <redacted>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log
<Directory /var/www/html>
AllowOverride All
</Directory>
<Location /alpha>
AuthType Basic
AuthName "Restricted Access - Authenticate"
AuthUserFile /etc/httpd/htpasswd.users
Require valid-user
</Location>
<Location /UserControl>
AuthType Basic
AuthName "Restricted Access - Authenticate"
AuthUserFile /etc/httpd/htpasswd.users
Require valid-user
</Location>
Redirect /alpha /alpha/
ProxyPass /alpha/ http://127.0.0.1:3838/alpha/
ProxyPassReverse /alpha/ http://127.0.0.1:3838/alpha/
WSGIDaemonProcess UserControl user=ubuntu group=ubuntu threads=5
WSGIScriptAlias / /home/ubuntu/FlaskApps/UserControl/UserControl.wsgi
<Directory /home/ubuntu/FlaskApps/UserControl>
WSGIProcessGroup UserControl
WSGIApplicationGroup %{GLOBAL}
WSGIScriptReloading On
Order deny,allow
#Allow from all
Require all Granted
</Directory>
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Run Code Online (Sandbox Code Playgroud)
但是,当我转到http://servername 时,我得到的只是 404 错误。未找到该页面。我已经开始了一段时间了,不知道为什么。
对于它的价值,http://myservername/alpha和http://myservername/UserControl都可以工作,因此 apache 可以正常工作。
任何帮助将非常感激。
尝试:
<Directory /var/www/html>
AllowOverride All
Require all granted # required in Apache 2.4
</Directory>
Run Code Online (Sandbox Code Playgroud)
是index.html实际上指定为DirectoryIndex地方?将其添加到您的 vhost 配置中以确保。
如果这些都没有帮助,请谨慎行事并从简单开始。删除所有与当前问题无关的内容,并使用非常基本的配置。
<VirtualHost *:80>
Servername <redacted>
ServerAdmin webmaster@localhost
DocumentRoot "/var/www/html" # try quoting
DirectoryIndex index.html # just in case
ErrorLog /full/path/to/error.log # fully specified
CustomLog /full/path/to/access.log # fully specified
<Directory "/var/www/html"> # quoted
AllowOverride All
Require all granted # required in Apache 2.4
</Directory>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
另外,我注意到你有这个:
Order deny,allow
#Allow from all
Require all Granted
Run Code Online (Sandbox Code Playgroud)
首先,文档建议不要混合使用新旧格式的访问控制,因此您可能希望摆脱Order deny,allow. 其次,我认为Granted应该是小写,granted.