Skip to content

Instantly share code, notes, and snippets.

@bootjp
Created December 14, 2014 13:33
Show Gist options
  • Save bootjp/1adbb0aaa7582672c679 to your computer and use it in GitHub Desktop.
Save bootjp/1adbb0aaa7582672c679 to your computer and use it in GitHub Desktop.
FC2ブログOSS版のNginxの設定
server {
listen 80;
server_name fc2blogtest.bootjp.me; #書き換えください
charset UTF-8;
access_log /var/log/nginx/fc2blogtest.bootjp.me.access.log main;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Credentials true;
add_header Access-Control-Allow-Methods "POST, GET, OPTIONS";
add_header X-Frame-Options SAMEORIGIN;
add_header X-XSS-Protection "1; mode=block"; # 投稿時にControllerでX-XSS-Protection 0しているからないほうがいいかもしれない
add_header X-Content-Type-Options nosniff;
location / {
root /var/www/hogehoge/public;
index index.php index.html index.htm;
if (-f $request_filename) {
expires 7d;
break;
}
if ($request_uri ~* "(png|jpg$|css|js)") {
expires 7d;
break;
}
try_files $uri $uri/ /index.php?$args;
}
location /admin {
try_files $uri $uri/ /admin/index.php?$args;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri $uri/ /index.php?$args;
root /var/www/hogehoge/public;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_cache_valid 200 60m;
fastcgi_cache_valid 301 1d;
fastcgi_cache_valid 404 1m;
fastcgi_buffer_size 32m;
fastcgi_buffers 128 32m;
expires 7d;
break;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment