nginx配置

相关连接:https://nginx.org/download/nginx-1.6.3.tar.gz

                 https://nginx.org/download/nginx-1.16.1.tar.gz

官网:https://nginx.org/en/download.html

  1. nginx安装

3.1 安装nginx所需的pcre库,openssl 以及检查

[root@cowboy ~]# rpm -qa |grep openssl

openssl-libs-1.0.2k-19.el7.x86_64

openssl-1.0.2k-19.el7.x86_64

openssl-devel-1.0.2k-19.el7.x86_64

xmlsec1-openssl-1.2.20-7.el7_4.x86_64

[root@cowboy ~]# rpm -qa |grep openssl-devel

openssl-devel-1.0.2k-19.el7.x86_64

[root@cowboy ~]# rpm -q pcre

pcre-8.32-17.el7.x86_64

[root@cowboy ~]# rpm -q pcre-devel

pcre-devel-8.32-17.el7.x86_64

 

3.2 检查当前的系统环境[root@cowboy ~]# cat /etc/redhat-release

CentOS Linux release 7.7.1908 (Core)

[root@cowboy ~]# uname -r

3.10.0-1062.el7.x86_64

[root@cowboy ~]# uname -m

x86_64

 

3.2 开始安装Nginx

[root@cowboy ~]# mkdir -p /home/cowboy/tools/ 创建下载目录

[root@cowboy ~]# cd  /home/cowboy/tools/

[root@cowboy tools]#

[root@cowboy tools]# wget https://nginx.org/download/nginx-1.16.1.tar.gz

[root@cowboy tools]# tar -xzf nginx-1.16.1.tar.gz

[root@cowboy tools]# useradd -s /sbin/nologin/ nginx 创建服务用户

[root@cowboy tools]# cd nginx-1.16.1/ cd到解压后目录下

root@cowboy nginx-1.16.1]# mkdir -p /application/nginx/ 创建安装目录

[root@cowboy nginx-1.16.1]# ./configure --user=nginx --group=nginx --prefix=/application/nginx/ --with-http_stub_status_module --with-http_ssl_module 预编译

[root@cowboy nginx-1.16.1]# echo $?

0

查询是否编译成功

Make

Make install

[root@cowboy nginx-1.16.1]# echo $?

0

查询是否安装成功

[root@cowboy nginx-1.16.1]# /application/nginx/sbin/nginx -t  检查语法

nginx: the configuration file /application/nginx//conf/nginx.conf syntax is ok

nginx: configuration file /application/nginx//conf/nginx.conf test is successful

[root@cowboy nginx-1.16.1]# /application/nginx/sbin/nginx 启动成功

[root@cowboy nginx-1.16.1]# netstat -lntup|grep nginx 查看端口

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      63475/nginx: master

 

[root@cowboy nginx-1.16.1]# wget 127.0.0.1 检测

--2020-03-20 03:09:22--  http://127.0.0.1/

Connecting to 127.0.0.1:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 612 [text/html]

Saving to: ‘index.html’

 

100%[=============================================================>] 612         --.-K/s   in 0s     

 

2020-03-20 03:09:22 (45.1 MB/s) - ‘index.html’ saved [612/612]

 

关闭selinux

[root@cowboy nginx-1.16.1]# getenforce

Enforcing

[root@cowboy nginx-1.16.1]# setenforce 0

[root@cowboy nginx-1.16.1]# getenforce

Permissive

关闭防火墙

[root@cowboy nginx-1.16.1]# systemctl stop firewalld

[root@cowboy nginx-1.16.1]# systemctl status firewalld

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值