ubuntu 下 wordpress 設定 Permalink 為 自定義結構後出現404頁面 nginx
阿新 • • 發佈:2019-02-04
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 }