centos7利用yum安装lnmp的教程(linux+nginx+php7.1+mysql5.7)

2019-10-10 13:20:28于丽

验证php7.1.x和扩展是否安装成功

验证php是否安装成功

php -v

验证对应的扩展是否安装成功

php -m

设置php-fpm并检测php-fpm的运行状态

启动php-fpm

service php-fpm star

检查启动是否成功

service php-fpm status

设置开机自启动

systemctl enable php-fpm.service

检查开机自启动是否设置成功

systemctl list-dependencies | grep php-fpm
ps -ef | grep php-fpm

nginx配置如下:

server{
 listen  80;
 server_name youserver;
 index index.html index.php;
 root /home/public;
 #charset koi8-r;
 #access_log logs/host.access.log main;
 location / {
  index index.html index.htm index.php;
  try_files $uri $uri/ /index.php?$query_string;
  }
 error_page 404    /404.html;
 # redirect server error pages to the static page /50x.html
 #
 error_page 500 502 503 504 /50x.html;
 location = /50x.html {
  root html;
 }
 # proxy the PHP scripts to Apache listening on 127.0.0.1:80
 #
 #location ~ .php$ {
 # proxy_pass http://127.0.0.1;
 #}
 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
 #
 location ~ .php$ {
  root   /home/public;
  fastcgi_pass 127.0.0.1:9000;
  fastcgi_index index.php;
  fastcgi_param SCRIPT_FILENAME /home/public$fastcgi_script_name;
  include  fastcgi_params;
}
 # deny access to .htaccess files, if Apache's document root
 # concurs with nginx's one
 #
 location ~ /.ht {
  deny all;
 }
}

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,如果有疑问大家可以留言交流,谢谢大家对易采站长站的支持。