# vi /usr/share/nginx/html/index.php <?php phpinfo();
⇒以下の設定が必要(基本設定)
# diff /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.org 30,36c30,36 < location ~ \.php$ { < root /usr/share/nginx/html; ## ドキュメントルートの定義 < fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; ## php-fpmとソケットで通信 < fastcgi_index index.php; < fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; < include fastcgi_params; < } --- > #location ~ \.php$ { > # root html; > # fastcgi_pass 127.0.0.1:9000; > # fastcgi_index index.php; > # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; > # include fastcgi_params; > #}
# mkdir /usr/share/nginx/html/test # vi /usr/share/nginx/html/test/date.php <?php var_dump(time());
⇒基本設定以外、特に対応の必要なし
# mkdir /tmp/tmp # ln -fns /tmp/tmp /usr/share/nginx/html/ # vi /tmp/tmp/index.php <?php phpinfo();
⇒基本設定以外、特に対応の必要なし
# mkdir /tmp/ali # vi /tmp/ali/date.php <?php var_dump(time());
⇒以下の設定が必要
# diff /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.org < < location /ali/ { < alias /tmp/ali/; < index index.php index.html index.htm; < < location ~ \.php$ { < fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; < fastcgi_index index.php; < fastcgi_split_path_info ^/ali(.+\.php)(.*)$; < fastcgi_param SCRIPT_FILENAME /tmp/ali$fastcgi_script_name; < include fastcgi_params; < } < }