欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 教育 > 幼教 > lnmp nginx 安装与配置

lnmp nginx 安装与配置

2024/10/23 23:28:01 来源:https://blog.csdn.net/qq_24946333/article/details/140093904  浏览:    关键词:lnmp nginx 安装与配置

1,安装方式 

#yum 安装
yum install -y nginx

2,配置

find / -name nginx.conf vi /etc/nginx/nginx.conf  找到 38 行左右 server 如下配置server {listen       80;#端口listen       [::]:80;#端口server_name  _;root         /var/www/html/; #根目录# Load configuration files for the default server block.include /etc/nginx/default.d/*.conf;index index.php index.html index.htmerror_page 404 /404.html;location = /404.html {}error_page 500 502 503 504 /50x.html;location = /50x.html {}location / {try_files $uri $uri/ /index.php?$query_string;}location ~ \.php$ {root           /var/www/html/;fastcgi_pass   127.0.0.1:9000;                    fastcgi_index  index.php;fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;include        fastcgi_params;}}

3,php-fpm

启动 nginx 前确保开启php-fpm           

ps -ef | grep php-fpm
#没有开启 执行下面命令
systemctl enable php-fpm #开机启动
service php-fpm start #开启php-pfm 

4,启动nginx

systemctl restart  nginx
systemctl enable nginx

 

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com