Skip to content

Instantly share code, notes, and snippets.

@naniwaKun
Last active March 9, 2017 04:05
Show Gist options
  • Save naniwaKun/4603ad9bb1bcd71192526e0d326b5e19 to your computer and use it in GitHub Desktop.
Save naniwaKun/4603ad9bb1bcd71192526e0d326b5e19 to your computer and use it in GitHub Desktop.
nginxのwordpressのマトリョーシカ設定 ref.http://cfw4.tk/wordpress/500
server {
 listen 80;
 server_name domain;
 charset UTF-8;
 index index.php index.html index.htm;
 root /公開パス;
 try_files $uri $uri/ /index.php?q=$uri&$args;
 location ~ \.php$ {
  root /公開パス;
  fastcgi_pass 環境に合わせて書く;
  fastcgi_index index.php;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  include fastcgi_params;
 }
 location /wordpress {
  index /blog/index.php;
  if (!-e $request_filename) {
   rewrite ^/blog(.+)$ /blog/index.php?q=$1 last; 
   break;
  }
 }
 location ~ ^/blog/.+\.php$ {
  fastcgi_pass 環境に合わせて書く;
  fastcgi_index index.php;
  fastcgi_split_path_info ^/blog(.+\.php)(.*)$;
  fastcgi_param SCRIPT_FILENAME /公開パス/blog$fastcgi_script_name;
  fastcgi_intercept_errors on;
  include fastcgi_params;
 }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment