[求助]CentOS 5.5+Nginx做ghs.google.com反向代理

Linux VPS 支持
回复
Visame
帖子: 10
注册时间: 2010-08-24 16:40

[求助]CentOS 5.5+Nginx做ghs.google.com反向代理

#1

帖子 Visame » 2010-08-24 22:14

以下是我的配置文件:

代码: 全选

user  nobody nobody;
worker_processes 3;
error_log  /var/log/nginx/error.log  notice;
pid        /var/run/nginx.pid;
events
{
worker_connections 1000;
}
http
{
upstream ghs {
	ip_hash;
	server ghs.google.com;
	server 72.14.203.121;
	server 72.14.207.121;
	server 74.125.43.121;
	server 74.125.47.121;
	server 74.125.53.121;
	server 74.125.77.121;
	server 74.125.93.121;
	server 74.125.95.121;
	server 74.125.113.121;
	server 216.239.32.21;
	server 216.239.34.21;
	server 216.239.36.21;
	server 216.239.38.21;
}

server {
	listen 184.82.2.*;
	server_name *.visame.org;
	access_log  /var/log/nginx/ghs.visame.name.log;

	location / {
		proxy_redirect off;
		proxy_set_header Host $host;
		proxy_pass http://ghs;
		proxy_set_header  X-Real-IP  $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_redirect false;
	}
}
}
184.82.2.*是我的burst主机IP
然后我将网站A记录改为
可以运行,但是184.82.2.*
未成功

谁成功配置了,请贴出完整配置文件
谢谢
头像
pityonline
帖子: 3864
注册时间: 2008-12-09 12:44
来自: 北京
联系:

Re: [求助]CentOS 5.5+Nginx做ghs.google.com反向代理

#2

帖子 pityonline » 2010-08-24 22:18

代码: 全选

# You may add here your
# server {
#	...
# }
# statements for each of your virtual hosts

server {
	listen   80;
	server_name  itwit.info;

	access_log  /var/log/nginx/itwit.access.log;

	location / {
            proxy_pass http://twitter.com/;
            proxy_redirect off;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	}

	location /doc {
		root   /usr/share;
		autoindex on;
		allow 127.0.0.1;
		deny all;
	}

	location /images {
		root   /usr/share;
		autoindex on;
	}

	error_page  404  /404.html;

	# redirect server error pages to the static page /50x.html
	#
	error_page   500 502 503 504  /50x.html;
	location = /50x.html {
		root   /var/www/;
	}

	# proxy the PHP scripts to Apache listening on 127.0.0.1:80
	#
	#location ~ \.php$ {
		#proxy_pass   http://127.0.0.1;
	#}

	# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
	#
	location ~ \.php$ {
		fastcgi_pass   127.0.0.1:9000;
		fastcgi_index  index.php;
		fastcgi_param  SCRIPT_FILENAME  /home/pity/rabr$fastcgi_script_name;
		include /etc/nginx/fastcgi_params;
                fastcgi_intercept_errors on;
	}

	# deny access to .htaccess files, if Apache's document root
	# concurs with nginx's one
	#
	location ~ /\.ht {
		deny  all;
	}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
#listen   8000;
#listen   somename:8080;
#server_name  somename  alias  another.alias;

#location / {
#root   html;
#index  index.html index.htm;
#}
#}


# HTTPS server
#
server {
listen   443;
server_name  itwit.info;

ssl  on;
ssl_certificate  /etc/nginx/ssl/server.crt;
ssl_certificate_key  /etc/nginx/ssl/server.key;

ssl_session_timeout  5m;

ssl_protocols  SSLv2 SSLv3 TLSv1;
ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers   on;

location / {
            proxy_pass https://twitter.com/;
            proxy_redirect off;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
这是ubuntu server 10.04上的配置。
Pity is the bomp!
活着就是折腾!生命不息,折腾不止!
看这帮家伙在干什么?@pityonline/u
Dropbox+Vps+PC 跑起来了!这是邀请链接
Visame
帖子: 10
注册时间: 2010-08-24 16:40

Re: [求助]CentOS 5.5+Nginx做ghs.google.com反向代理

#3

帖子 Visame » 2010-08-25 11:44

我用CentOS自带的Apache已经搞定了
谢谢大家
回复