首页 > 系统相关 >ubuntu20配nginx代理yum源,内网不能上网

ubuntu20配nginx代理yum源,内网不能上网

时间:2022-11-06 19:31:31浏览次数:53  
标签:00 http 1.1 centos nginx yum 64 ubuntu20

1、yum-server

# yum-server 外网IP 1.1.1.1

root@yum-ser:/etc/nginx/sites-available# cat default

server {

listen 80 default_server;

server_name 1.1.1.1;

client_max_body_size 1024M;

location /centos/ {

proxy_pass http://mirrors.aliyun.com/centos/ ;

}

}


2、yum-client 验证

root@yum-ser:/etc/nginx/sites-available# cat /root/CentOS7-1.1.1.1.repo

[base]
name=CentOS-$releasever - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://1.1.1.1/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://1.1.1.1/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://1.1.1.1/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://1.1.1.1/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://1.1.1.1/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://1.1.1.1/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
baseurl=http://1.1.1.1/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://1.1.1.1/centos/RPM-GPG-KEY-CentOS-7

3、验证

报错超时

[root@yum-client ~]# yum clean all;yum makecache
Loaded plugins: fastestmirror
Cleaning repos: base extras updates
Cleaning up list of fastest mirrors
Loaded plugins: fastestmirror
Determining fastest mirrors
http://1.1.1.1/centos/7/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://20.135.1.200/centos/7/os/x86_64/repodata/repomd.xml: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
Trying other mirror.
http://1.1.1.1/centos/7/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://20.135.1.200/centos/7/os/x86_64/repodata/repomd.xml: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
Trying other mirror.

4、处理

root@yum-ser:~# service nginx reload

root@yum-ser:~# nginx -s reload

5、再验证

[root@yum-client yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: 1.1.1.1
* extras: 1.1.1.1
* updates: 1.1.1.1
http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30001 milliseconds')
Trying other mirror.
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error"
Trying other mirror.
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/10): base/7/x86_64/group_gz | 153 kB 00:00:00
(2/10): base/7/x86_64/primary_db | 6.1 MB 00:00:04
(3/10): extras/7/x86_64/primary_db | 249 kB 00:00:00
(4/10): extras/7/x86_64/filelists_db | 276 kB 00:00:00
(5/10): extras/7/x86_64/other_db | 149 kB 00:00:00
(6/10): base/7/x86_64/filelists_db | 7.2 MB 00:00:05
(7/10): base/7/x86_64/other_db | 2.6 MB 00:00:02
(8/10): updates/7/x86_64/primary_db | 17 MB 00:00:06
(9/10): updates/7/x86_64/other_db | 1.2 MB 00:00:01
(10/10): updates/7/x86_64/filelists_db | 9.6 MB 00:00:09
Metadata Cache Created

[root@yum-client yum.repos.d]# yum install -y tmux
Loaded plugins: fastestmirror
................


标签:00,http,1.1,centos,nginx,yum,64,ubuntu20
From: https://blog.51cto.com/ibmcn/5827538

相关文章

  • CentOS 的 YUM安装时卡死解决方案
    YUM是基于RPM的软件包管理器YUMisanRPM-basedpackagemanager补充说明​Supplementarynoteyum命令是在Fedora和RedHat以及SUSE中基于rpm的软件包管理器,它可以使系统管......
  • YUM下载全量依赖
        在离线的内网环境下进行安装一些软件的时候会出现依赖不完整的情况,一般情况下会使用如下方式进行下载依赖包    查看依赖包可以使用yum deplist进行查找[roo......
  • Hikvison对接NVR实现WEB无插件开发包实现前端视频预览(html、vue、nginx代理)
    场景Vue中预览HIKVSION海康威视的NVR(网络硬盘录像机)中多个通道(摄像机)的视频:https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/124155295在上面进行NVR视......
  • Nginx 反向代理
    1、业务场景内网服务器无法通过外网访问到时,这时候需要一台跳板机来实现2、概念介绍Nginx是一款自由的、开源的、高性能的HTTP服务器和反向代理服务器;同时也是一个IM......
  • NGINX重启发生报错 nginx: [error] open() “/run/nginx.pid“ failed
    nginx[error]open()“/usr/local/var/run/nginx.pid”failed(2:Nosuchfileordirectory)nginx:[error]open()“/run/nginx.pid”failed(2:Nosuchfileord......
  • Nginx配置安全选项
    默认网站配置(未更改前)server{listen80;server_namelocalhost;location/{roothtml;indexindex.htmlindex.htm;......
  • nginx重新整理 ---- 系列文章
    介绍nginx和apache的一些原理和应用nginx重新整理——————http请求的11个阶段中的日志阶段[十九]nginx重新整理——————http请求的11个阶段中的content阶段[十......
  • Docker部署Nginx报错 WARNING: IPv4 forwarding is disabled. Networking will not wo
    Docker部署Nginx报错WARNING:IPv4forwardingisdisabled.Networkingwillnotwork.[root@localhost~]#dockerrun--namenginx-1-p8080:80-dnginx  ......
  • Nginx将请求转发至后端应该怎么做?
    新建一个nginxserver在nginx的配置文件中新建一个server监听前端部署的端口server{#监听端口listen80;server_name网站名称;}使用Nginx代理前端页面然后在se......
  • linux 环境nginx 快捷启动配置
    一般nginx安装后,得到nginx安装目录sbin文件夹里启动nginx/usr/local/nginx/sbin/nginx-sstart可以配置环境变量,来直接输入nginx来启动,停止,检测配置,重启1.编辑用户......