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

Nginx環境でconcrete5をサブディレクトリに配置して、プリティーURLを有効にする

More than 3 years have passed since last update.

概要

Nginx環境で、サブディレクトリにconcrete5が配置してある際に、プリティーURLを有効にする設定の覚え書き

ディレクトリ構造
/rootdir/
+ /subdir/ (←ここにconcrete5をインストール)

要点

  • PHP-FPMの設定
  • リライトの設定

SampleConfig(nginx.conf)

nginx.conf
http {

    server {
        root         /var/www/html;

        location / {
            index  index.html;
        }

# サブディレクトリにアクセスがあった際に index.php をURLから除外する設定
        location /subdir {
            index  index.php;
            if (!-e $request_filename) {
            rewrite ^/subdir/ /subdir/index.php last; 
            }
        }   

# サブディレクトリにある 拡張子が .php ファイルを php-fpm に処理を回す設定
        location ~ ^/subdir/\.php($|/)  {
             include       fastcgi_params;
             fastcgi_pass  127.0.0.1:9000;
             fastcgi_index index.php;
             fastcgi_param URI $uri;
             fastcgi_param SERVER_NAME $host;
             fastcgi_param REQUEST_METHOD $request_method;
             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
             fastcgi_read_timeout 30;
        }

    }
}

備考

この設定をすれば、Wordpressでも、CakePHPでもNginx環境のサブディレクトリでも可能のはず。

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
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