Centos7安装Nginx服务

in 运维手册 with 0 comment

安装依赖包

yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel

下载安装包

wget http://nginx.org/download/nginx-1.16.0.tar.gz

或者自行去选择自己需要的Nginx版本下载:http://nginx.org/download/

安装Nginx

tar zxvf nginx-1.16.0.tar.gz
cd nginx-1.16.0
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install

安装结束

[root@Linux6 nginx-1.16.0]# ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx      # 添加Nginx软连接
[root@Linux6 nginx-1.16.0]# nginx -v      # 查看Nginx版本
nginx version: nginx/1.16.0
[root@Linux6 nginx-1.16.0]# nginx         # 启动Nginx服务

Nginx页面.png

常用命令

nginx                      # 启动 Nginx
nginx -s reopen            # 重启 Nginx
nginx -s stop              # 停止 Nginx
nginx -s reload            # 重新载入配置文件
nginx -t                   # 检查 Nginx 配置文件的正确性
Responses