WordPressをnginxで動かす設定
nginxの設定はこんな感じにするとよい
server {
listen 80;
server_name wp.tknzk.net;
access_log /var/log/nginx/wp.tknzk.net.access.log;
error_log /var/log/nginx/wp.tknzk.net.error.log;
location / {
root /var/www/html/wp.tknzk.net;
index index.php index.html index.htm;
# static files
if (-f $request_filename) {
expires 30d;
break;
}
# request to index.php
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php?q=$1 last;
}
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html/wp.tknzk.net/$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}