Centos7下编译安装配置Nginx+PHP+MySql环境

2019-10-12 15:01:47刘景俊

2.3 修改完成

  # 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 $document_root$fastcgi_script_name;
   include  fastcgi_params;
  }

2.4 输出phpinfo文件

echo "<?php echo phpinfo(); ?>" > /lnmp/nginx/html/index.php

2.5 启动nginx

/lnmp/nginx/sbin/nginx

小章总结:

完成上面的修改就可以让nginx来转发php的动态脚本请求。

不过目前还不能打开php文件,因为还没有打开php-fpm。

我们继续向下看。

 三、开始配置(php-fpm)

3.1 copy默认配置文件

# cd /source/php-7.0.2
# cp php.ini-development /lnmp/php/etc/php.ini

# cd /lnmp/php/etc
# cp php-fpm.conf.default php-fpm.conf

# cd /lnmp/php/etc/php-fpm.d/
# cp www.conf.default www.conf

3.2 运行php-fpm

# /lnmp/php/sbin/php-fpm -c /lnmp/php/etc/php.ini

二、常用命令

nginx常用命令

启动nginx

# /lnmp/nginx/sbin/nginx

重启nginx

# /lnmp/nginx/sbin/nginx -s reload

关闭nginx

# /lnmp/nginx/sbin/nginx -s stop

php-fpm常用命令

启动php-fpm

# /lnmp/php/sbin/php-fpm -c /lnmp/php/etc/php.ini

重启php-fpm

# kill -SIGUSR2 `cat /lnmp/php/var/run/php-fpm.pid`

关闭php-fpm

# kill -SIGINT `cat /lnmp/php/var/run/php-fpm.pid`

信号解释:

SIGINT, SIGTERM 立刻终止 SIGQUIT 平滑终止 SIGUSR1 重新打开日志文件 SIGUSR2 平滑重载所有worker进程并重新载入配置和二进制模块

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持易采站长站。