CentOS7下搭建nginx反向代理服务器使得外网可以二级域名访问内网应用

创建nginx的本地yum源

[root@localhost ~]# yum list |grep nginx
No package nginx available.
[root@localhost ~]# //给跪了,什么鬼,怎么没有nginx的rpm?算了,直接自己手动配一个官网repo吧
[root@localhost ~]# //访问nginx官网,进入dowload页面,翻到底部的Pre-Build Package,选stable version
---------------------------
To set up the yum repository for RHEL/CentOS, create the file named /etc/yum.repos.d/nginx.repo with the following contents:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1
Replace “OS” with “rhel” or “centos”, depending on the distribution used, and “OSRELEASE” with “5”, “6”, or “7”, for 5.x, 6.x, or 7.x versions, respectively.
---------------------------
[root@localhost ~]#
[root@localhost ~]# //大意就是:创建/etc/yum.repos.d/nginx.repo文件,贴入模板内容,替换相应的系统和软件版本号
[root@localhost ~]#
[root@localhost ~]# cd /etc/yum.repos.d
[root@localhost yum.repos.d]# vi nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1

:wq

以yum方式安装nginx

[root@localhost yum.repos.d]# yum list |grep nginx
nginx.x86_64                               1:1.10.0-1.el7.ngx          nginx    
nginx-debug.x86_64                         1:1.8.0-1.el7.ngx           nginx    
nginx-debuginfo.x86_64                     1:1.10.0-1.el7.ngx          nginx    
nginx-module-geoip.x86_64                  1:1.10.0-1.el7.ngx          nginx    
nginx-module-image-filter.x86_64           1:1.10.0-1.el7.ngx          nginx    
nginx-module-njs.x86_64                    1:1.10.0.0.0.20160414.1c50334fbea6-1.el7.ngx
                                                                       nginx    
nginx-module-perl.x86_64                   1:1.10.0-1.el7.ngx          nginx    
nginx-module-xslt.x86_64                   1:1.10.0-1.el7.ngx          nginx    
nginx-nr-agent.noarch                      2.0.
  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值