安裝php yum install php yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc yum install php yum install php-mysql php-gd ...
安裝php
yum install php
yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
|
添加nginx 預設主頁index.php
vim /etc/nginx/conf.d/default.conf
location / {
root /usr/share/nginx/html; //改路徑
index index.html index.htm index.php; //index.php
}
配置nginx支持php
vim /etc/nginx/conf.d/default.conf
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ .php$ {
root html; //改路徑
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name; //改路徑
include fastcgi_params;
}
配置php-fpm
vim /etc/php-fpm.d/www.conf
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = nginx
; RPM: Keep a group allowed to write in log dir.
group = nginx
chkconfig php-fpm on #設置php-fpm自啟動
chkconfig mysqld on #設置mysqld自啟動
service nginx restart #重新啟動nginx
service php-fpm start #啟動php-fpm
service mysqld start #啟動mysqld