WordPressをnginxで動かしているのですが、固定ページの表示でハマってしまったので質問です。
以下のnginx.conf(一部)から、
###nginx.conf①
location / { index index.php try_files $uri $uri/ /index.php?q=$uri&$args; location ~* /wp-config.php { deny all; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/wordpress/$fastcgi_script_name; include /etc/nginx/fastcgi_params; } }
以下(②)の設定に変更しました。
###nginx.conf②
location / { try_files $uri $uri/ @wordpress; } location ~ \.php$ { try_files $uri @wordpress; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/wordpress$fastcgi_script_name; include fastcgi_params; } location @wordpress { fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/wordpress/index.php; include fastcgi_params; }
しかし、①の設定では固定ページが404で表示されず、②の設定ではTOPページやダッシュボードが403で表示されません。
nginx.confをどのように設定すれば全てのページが表示されるのかわからず、途方にくれています。
わかる方がいらっしゃいましたら、よろしくお願いします。
#追加情報
WordPressのインストール先は/usr/share/nginx/wordpressです。
回答2件
あなたの回答
tips
プレビュー