您的位置:首页 > 运维架构 > Nginx

ubuntu 下 wordpress 设置 Permalink 为 自定义结构后出现404页面 nginx - 404 not found page for permalinks

2015-05-08 15:22 746 查看
1. 先打开 nginx 配置文件 default

cd /etc/nginx/sites-available/


2. 编辑 default 文件

sudo vi default


3. server 内的 location /{ ... } 加入

try_files $uri $uri/ /index.php?$args;


完成如下:

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

root /usr/share/nginx/html;
index index.php index.htm;

# Make site accessible from http://localhost/ server_name localhost;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?$args;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: