我在虚拟机中启动了一个新服务器,我可以从浏览器访问它的主页。我设置了一个托管在端口 90 上的 docker 容器,我也可以访问它。为了链接/app/
到,localhost:90
我启用了模块并按照官方文档proxy
编辑为以下配置:000-default.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyRequests off
<Proxy *>
ProxyPreserveHost Off <- I tried On
Require all granted
</Proxy>
ProxyPass /app/ http://localhost:90/ <- I tried without trailing slashes on both arguments and lines. (I get 500 response without them)
ProxyPassReverse /app/ http://localhost:90/
</VirtualHost>
从虚拟机或外部的相同路由打开时,localhost/app
出现 404 错误。这里可能出了什么问题?
apache2ctl -S
输出:
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:80 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex watchdog-callback: using_defaults
Mutex proxy: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33 not_used
Group: name="www-data" id=33 not_used
错误日志中没有错误
答案1
原来我打字localhost/app
的地方应该是localhost/app/
...是的,我知道。