Created
December 14, 2014 13:33
-
-
Save bootjp/1adbb0aaa7582672c679 to your computer and use it in GitHub Desktop.
FC2ブログOSS版のNginxの設定
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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