- 追加された行はこの色です。
- 削除された行はこの色です。
#author("2016-07-10T11:54:21+09:00","default:wikiwriter","wikiwriter")
#author("2016-07-10T13:57:07+09:00","default:wikiwriter","wikiwriter")
[[Nginx]]
&tag(Nginx/設定);
*目次 [#bc5e42a0]
#contents
*関連ページ [#u1e285ac]
*参考情報 [#w2825af1]
*設定の基本 [#u41194c9]
-CentOS6の場合/etc/nginx/conf.d/default.confを編集。
*PHP-FPMとの連携 [#x013328e]
-CentOS6の場合default.confを以下のように設定する。最後のlocationディレクティブが肝心。
#pre{{
server {
listen 8080;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
(以下中略)
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}}
-ポート番号を変える場合iptablesで穴を買えることを忘れないように。locationディレクティブでrootとfastcgi_paramを変更すること。
-/etc/php-fpm.d/www.confの編集。Unix Socketを使う場合さらなる変更が必要。
#pre{{
user = nginx
group = nginx
}}
**Unix Socketで連携 [#u1eae7b4]
-/etc/php-fpm.d/www.confの編集
listen = /var/run/php-fpm/www.sock
-/etc/nginx/conf.d/default.confの編集。先頭にunixが必要なことに注意。
fastcgi_pass unix:/var/run/php-fpm/www.sock