LoginSignup
10
10

More than 5 years have passed since last update.

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

Last updated at Posted at 2015-07-29

概要

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環境のサブディレクトリでも可能のはず。

10
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
10