Nginx-1.19.6安装和初步使用

1、Nginx-1.19.6安装

# 安装依赖 
$ yum -y install gcc pcre-devel zlib-devel openssl openssl-devel 

# 解压缩到/usr/local/src/ 
$ tar -zxvf nginx-1.19.6.tar.gz -C /usr/local/src/ 

# 进入解压后目录,编译 
$ cd /usr/local/src/nginx-1.19.6/ 
$ ./configure --with-http_ssl_module --prefix=/usr/local/nginx 
$ make 
$ make install


nginx可执行文件的路径为/usr/local/nginx/sbin

#查看版本
$/usr/local/nginx/sbin/nginx -V

 2、初步使用

2.1、配置nginx.conf

进入/usr/local/nginx/conf/nginx.conf

$ cd usr/local/nginx/conf/nginx.conf

$vim nginx.conf

修改端口:8081

proxy_pass  http://www.baidu.com

 #重启nginx:

$../sbin/nginx -s reload

2.2、postman访问

访问http://10.1.1.235:8081 会跳转到:http://www.baidu.com页面

期间遇到无法访问时,查看防火墙是运行状态,关闭防火墙

[root@loaclhost conf]# firewall-cmd --state
running

[root@loaclhost conf]# systemctl stop firewalld

[root@loaclhost conf]# firewall-cmd --state
not running

参考:https://blog.csdn.net/fen_fen/article/details/105653862

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

宁宁可可

您的鼓励是我创作的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值