Nginx的部署

nginx包下载地址:http://nginx.org/download/


Nginx的部署

该部署使用的Red Hat 7为例

1.安装依赖包

    yum install gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel -y

2.新增nginx用户

    groupadd nginx

    useradd nginx -g nginx

3.解压安装包

    tar -zxvf nginx-1.18.0.tar.gz

    cd nginx-1.18.0

    ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --with-http_stub_status_module  --with-http_ssl_module --with-stream

参数说明: 
--with-http_stub_status_module:监控页面模块
--with-http_ssl_module:ssl模块
--with-stream:stream模块,nginx从1.9.0开始,新增加了一个stream模块,用来实现四层协议的转发、代理或者负载均衡等

    make && make install

4.启动nginx

    cd /usr/local/nginx/sbin

    ./nginx

nginx其他命令说明:
./nginx -t            查看状态
./nginx -s reload     重新加载配置文件
./nginx -s reopen     切割 nginx 日志文件
./nginx -s stop       停止
./nginx -V            查看nginx信息
pkill -9 nginx        强制杀死nginx

  

5.访问NGINX页面

  #访问主机IP:80(默认80端口)


至此,NGINX就部署完成了!

接下来,我们就该对NGINX进行配置了。可以参考我之前编写的NGINX配置进行了解。

 

posted @ 2022-03-04 15:47  RFAA  阅读(59)  评论(0编辑  收藏  举报