Help us understand the problem. What is going on with this article?

Wordpress+Nginxのパーマリンク設定

More than 1 year has passed since last update.

Wordpressでパーマリンク設定を変更すると404になる

誰もが経験したことのあるパーマリンク設定の404。
ページがナッシングだぜでお困りのそこのあなた。
Nginxの設定を書いておきます。

Wordpressのパーマリンク設定

設定を以下のようにしてみた。
image.png

これで、各個別記事、管理者画面、ログアウト画面で404になります。

Nginxの設定

/etc/nginx/conf.d/domainname.conf
server {
    listen       80;
    client_max_body_size 20M;
    server_name  domainname.net;
    root         /var/www/html/domainname;
    index        index.php index.html;

    location ~ \.php$ {
        root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME /var/www/html/domainname$fastcgi_script_name;
        #fastcgi_param  PATH_INFO $fastcgi_script_name;
        include        fastcgi_params;
        fastcgi_read_timeout 180;
    }


    include /etc/nginx/default.d/*.conf;

    location / {
        try_files $uri $uri/ @wordpress;
    }
    location ~ \.php$ {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /var/www/html/domainname$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  /var/www/html/domainname/index.php;
        include       fastcgi_params;
    }

    # redirect server error pages to the static page /40x.html
    #
    error_page 404 /404.html;
        location = /40x.html {
    }

    # redirect server error pages to the static page /50x.html
    #
    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
    }

}

こんな感じにすると直りました。

noracorn92
ひとりで合同会社arecoreをやっています。 システムエンジニアと、輸入物販をしています。 株式会社Ticketstarと契約していて、チケットのシステムを作成しています twitterもnoracornでやっております。 気軽に絡んでくださいw
http://arecore.net
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした