在能上外网的机器192.168.150.14上安装nginx
nginx.conf 配置
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server
{
listen 80;
server_name mirrors.163.com; #要访问的域名
location / {
proxy_pass http://mirrors.163.com; #转发域名
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
#access_log /home/wwwlogs/access.log access;
}
server
{
listen 80;
server_name mirror.centos.org; #要访问的域名
location / {
proxy_pass http://mirror.centos.org; #转发域名
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
#access_log /home/wwwlogs/access.log access;
}
server
{
listen 80;
server_name yum.puppetlabs.com; #要访问的域名
location / {
proxy_pass http://yum.puppetlabs.com; #转发域名
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
#access_log /home/wwwlogs/access.log access;
}
}
客户端 需要yum 到外网的配置:
vi /etc/hosts 配置多个域名的映射到跳板机
192.168.150.14 mirrors.163.com
192.168.150.14 mirror.centos.org
192.168.150.14 yum.puppetlabs.com
cd /etc/yum.repos.d
mkdir old
mkdir *.repo /old
下载163的源到本地
#见 http://mirrors.163.com/.help/centos.html
然后就可以直接使用yum 命令了
nginx.conf 配置
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server
{
listen 80;
server_name mirrors.163.com; #要访问的域名
location / {
proxy_pass http://mirrors.163.com; #转发域名
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
#access_log /home/wwwlogs/access.log access;
}
server
{
listen 80;
server_name mirror.centos.org; #要访问的域名
location / {
proxy_pass http://mirror.centos.org; #转发域名
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
#access_log /home/wwwlogs/access.log access;
}
server
{
listen 80;
server_name yum.puppetlabs.com; #要访问的域名
location / {
proxy_pass http://yum.puppetlabs.com; #转发域名
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
#access_log /home/wwwlogs/access.log access;
}
}
客户端 需要yum 到外网的配置:
vi /etc/hosts 配置多个域名的映射到跳板机
192.168.150.14 mirrors.163.com
192.168.150.14 mirror.centos.org
192.168.150.14 yum.puppetlabs.com
cd /etc/yum.repos.d
mkdir old
mkdir *.repo /old
下载163的源到本地
#见 http://mirrors.163.com/.help/centos.html
然后就可以直接使用yum 命令了