Nginx安装

基础材料:

nginx-1.12.2.tar.gz  CentOS7.4

安装步骤:

[root@localhost ~]# groupadd nginx

[root@localhost ~]# useradd -g nginx -s /sbin/nologin -M nginx

[root@localhost ~]# yum install gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel openssl openssl-devel -y

说明:

pcre pcre-devel:Nginx 的Rewrite模块和HTTP 核心模块会使用到PCRE正则表达式语法。
zlip zlib-devel:nginx启用压缩功能的时候,需要此模块的支持。

openssl openssl-devel:开启SSL的时候需要此模块的支持。

[root@localhost ~]# tar -zxvf nginx-1.12.2.tar.gz

[root@localhost ~]# cd nginx-1.12.2

[root@localhost ~]# ./configure  --prefix=/opt/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre

[root@localhost ~]# make && make install

说明:

prefix 指定编译安装路径

with-http_ssl_module 提供https服务支持

with-http_gzip_static_module 提供压缩支持

with-http_stub_status_module 提供基本状态信息访问支持

with-pcre 提供正则表达式支持

安装完成后生成目录说明:

conf:保存nginx所有的配置文件,其中nginx.conf是nginx服务器的最核心最主要的配置文件
html:目录中保存了nginx服务器的web文件,还有一个50x的web文件是默认的错误页面提示页面。
logs:用来保存nginx服务器的访问日志错误日志等日志
sbin:保存nginx二进制启动脚本

NGINX启动:

[root@localhost ~]# cd  /opt/nginx/sbin

[root@localhost ~]# ./nginx

NGINX停止

[root@localhost ~]# ./nginx -s stop

NGINX重新加载配置文件:

[root@localhost ~]# ./nginx -s reload

 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值