linux安裝nginx、php

一、添加php源

sudo add-apt-repository ppa:ondrej/php

二、安裝php

sudo apt-get update
sudo apt-get install php5-common php5-mysqlnd php5-xmlrpc php5-curl php5-gd php5-cli php5-fpm php-pear php5-dev php5-imap php5-mcrypt

三、安裝nginx(openresty)

安裝前準備php

apt-get install libpcre3-dev \
    libssl-dev perl make build-essential curl

下載openrestyhtml

tar -xzvf openresty-VERSION.tar.gz
cd openresty-VERSION/
./configure
make
sudo make install

四、修改nginx、php配置文件

修改nginx的nginx.confmysql

location ~ \.php$ {
    root           html;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

修改/etc/php5/fpm/pool.d/www.confnginx

五、重啓nginx和php

service php5-fpm restart
sbin/nginx  -s reload
相關文章
相關標籤/搜索