1. 首先安装nginx apache php php-apache php-fpm php-cgi php-gd php-mcrypt php-pgsql php-sqlite等软件包。
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php-fpm/php-fpm.sock|fcgi://localhost/"
</FilesMatch>
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
然后 systemctl restart httpd.service php-fpm.service 重启服务即可。
6. 编辑/etc/nginx/nginx.conf,首先把user一行改成 user http http ,然后修改server一栏如下:
server {
listen 80;
server_name localhost;
root /srv/nginx;
location / {
index index.html index.htm index.php;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
}
然后 systemctl restart nginx.service php-fpm.service 重启服务即可。
原文:http://www.cnblogs.com/frederichchen/p/4522379.html