Nginx部署

Nginx部署

经验文章nimo972025-06-23 20:29:164A+A-

一、准备工作

安装nginx前先安装 pcre pcre-devle openssl openssl-devel



二、安装nginx

./configure --user=nginx --group=nginx --prefix=/usr/local/nginx1.18 --with-http_stub_status_module --with-http_ssl_module


Make

Make install


三、检查启动


/usr/local/nginx/Sbin/Nginx -t 检查语法


/usr/local/nginx/Sbin/Nginx 启动nginx


sudo fuser -n tcp 80 –k 解除80端口占用


四、配置

根目录 root

站点目录 html


/usr/local/nginx/conf/fastcgi.conf 动态配置文件


/usr/local/nginx/conf/nginx.conf 静态配置文件




配置nginx.conf

每个server 一个站点

Server{

Listen 80;

Server_name localhost; 域名

Location / {

Root html ;

Index index.html index.html; 首页文件

}

Error_page 500 502 503 504 /50x.html;遇到500 等错误,跳的50x.html

Location = /50x.html {

Root html;

}

}

点击这里复制本文地址 以上内容由nimo97整理呈现,请务必在转载分享时注明本文地址!如对内容有疑问,请联系我们,谢谢!
qrcode

尼墨宝库 © All Rights Reserved.  蜀ICP备2024111239号-7