自分用めも
yumでインストールしたもの
- nginx
- php関連
- php-fpm
など
nginxでPHPスクリプトを実行させるための設定
メインの設定
/etc/nginx/conf.d/default.conf
〜〜(省略)〜〜
location ~ \.php$ {
#root html;
root ドキュメントルートのパス;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
〜〜(省略)〜〜
バーチャルホストの設定
/etc/nginx/conf.d/sample.conf
server {
listen 80;
server_name centos65.sample;
location / {
root /var/www/html/sample;
index index.php index.html index.htm;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html/sample/$fastcgi_script_name;
include fastcgi_params;
}
}