炫意html5
最早CSS3和HTML5移动技术网站之一

介绍Nginx配置支持PHP

1、添加 Nginx 配置
[root@qfedu.com php-fpm.d]#cd /etc/nginx
[root@qfedu.com conf]# vim nginx.conf
#配置如下
server
{
listen 80;
server_name localhost;
index index.html index.htm index.php;
root /usr/local/nginx/html;
location ~ \.php$
{
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
}
}
2、添加 php 探测文件
[root@qfedu.com ~]# cd /usr/local/nginx/html/
[root@qfedu.com html]# vim index.php
<?php
phpinfo();
?>
3、验证 Nginx 关联 php-fpm

1)重启 php-fpm

[root@qfedu.com html]# systemctl restart php-fpm.service
[root@localhost ~]# ps -ef|grep php-fpm
root 69652 1 0 14:02 ? 00:00:00 php-fpm: master process
(/usr/local/php7/etc/php-fpm.conf)
nginx 69653 69652 0 14:02 ? 00:00:00 php-fpm: pool www
nginx 69654 69652 0 14:02 ? 00:00:00 php-fpm: pool www
nginx 69655 69652 0 14:02 ? 00:00:00 php-fpm: pool www
nginx 69656 69652 0 14:02 ? 00:00:00 php-fpm: pool www
nginx 69657 69652 0 14:02 ? 00:00:00 php-fpm: pool www

2)重载 Nginx 配置

[root@qfedu.com html]# systemctl reload nginx
[root@qfedu.com html]# systemctl status nginx

3)访问验证

炫意HTML5 » 介绍Nginx配置支持PHP

Java基础教程Android基础教程