Wordpress 网站使用 apache2 运行,其配置如下:
Listen 81
<VirtualHost *:81>
DocumentRoot /home/foo/public_html
ServerName www.foo.fo
ServerAlias foo.fo
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
<Directory /home/foo/public_html>
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Nginx 配置:
server {
listen 80;
server_name foo.fo, www.foo.fo;
location / {
proxy_pass http://172.17.4.19:81;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
问题是只显示索引页。如果导航到另一个页面,比如说菜单-2,则返回错误 404。
apache2 访问日志
"GET /meniu-2/ HTTP/1.0" 404 463 "http://www.foo.fo/" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36"
如何使该配置起作用?