sudo su -

yum update

yum install nginx php-fpm php-xml php-pdo php-odbc \

php-soap php-common php-cli php-mbstring php-bcmath php-ldap \

php-imap php-gd php-pecl-apc

chkconfig nginx on

chkconfig php-fpm on

 

vim /etc/php-fpm.conf

 

emergency_restart_threshold 10

emergency_restart_interval 1m

process_control_timeout 15s

 

vim /etc/php-fpm.d/www.conf

 

;listen = 127.0.0.1:9000

listen = /var/run/php-fpm/php-fpm.sock

;listen.owner = nobody

listen.owner = nginx

;listen.group = nobody

listen.group = nginx

;listen.mode = 0666

listen.mode = 0664

 

user = nginx

group = nginx

 

vim /etc/nginx/nginx.conf

 

location ~ ^(?<SCRIPT>/.*\.(php|php3|phtml|suphp))$ {

uninitialized_variable_warn off;

set $fpm_url unix:/var/run/php-fpm/php-fpm.sock;

if (-f /etc/php5/fpm/pool.d/$cur_php_user.conf) {

set $fpm_url unix:/var/run/php-fpm/$cur_php_user.sock;

}

set $cur_php_user "";

fastcgi_index index.php;

include fastcgi_params;

fastcgi_param SCRIPT_NAME $SCRIPT;

fastcgi_param SCRIPT_FILENAME $document_root$SCRIPT;

fastcgi_pass $fpm_url;

}

location ~ ^(?<SCRIPT>/.*\.(php|php3|phtml|suphp))(?<PATH_INFO>.*)$ {

uninitialized_variable_warn off;

if ($PATH_INFO = "") {

# avoid empty path_info

set $PATH_INFO $SCRIPT;

}

set $fpm_url unix:/var/run/php-fpm/php-fpm.sock;

if (-f /etc/php5/fpm/pool.d/$cur_php_user.conf) {

set $fpm_url unix:/var/run/php-fpm/$cur_php_user.sock;

}

set $cur_php_user "";

fastcgi_index index.php;

include fastcgi_params;

fastcgi_param PATH_INFO $PATH_INFO;

fastcgi_param PATH_TRANSLATED $document_root$PATH_INFO;

fastcgi_param SCRIPT_NAME $SCRIPT;

fastcgi_param SCRIPT_FILENAME $document_root$SCRIPT;

fastcgi_pass $fpm_url;

}

 

引用:

http://imperialwicket.com/aws-install-nginx-and-php-fpm-on-amazon-linux

http://blog.teatime.com.tw/1/post/383

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 jeffath 的頭像
    jeffath

    jeffath的部落格

    jeffath 發表在 痞客邦 留言(0) 人氣()