使用Openshift+Nginx代理Google实现方便跨栏

由于众所周知的原因,在大陆访问Google需要跨栏。但是每次搜索都要启动跨栏软件有点不方便。下面介绍一种使用Openshift来跨栏的方法。首先是效果图:

点击搜索结果会跳出代理:

步骤:

一、准备空间:在WEB CONSOLE里创建一个DIY项目,使用SSH登录到后台。

二、编译Nginx:从nginx.orgwget下来,tar zxvf解包,同时准备ngx_cache_purgepcre,和nginx一起放在$OPENSHIFT_DATA_DIR里,解包并编译。

三、配置代理:编辑conf/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;
 port_in_redirect off;
 sendfile on;
 #tcp_nopush on;
 #keepalive_timeout 0;
 keepalive_timeout 65;
#A
 #gzip on;
 upstream google {
 server 74.125.239.112:80 max_fails=3;
 server 74.125.239.113:80 max_fails=3;
 server 74.125.239.114:80 max_fails=3;
 server 74.125.239.115:80 max_fails=3;
 server 74.125.239.116:80 max_fails=3;
}
 server {
 listen 127.10.227.129:8080;
 server_name localhost;
 #server_name google-i51.rhcloud.com;
 #rewrite ^(.*) https://XXX.rhcloud.com$1 permanent;
 #charset koi8-r;
 #access_log logs/host.access.log main;
 #location / {
 # root html;
 # index index.html index.htm;
#}

 #error_page 404 /404.html;

 # redirect server error pages to the static page /50x.html
#
 #error_page 500 502 503 504 /50x.html;
 location / {
 #proxy_cache one;
 #proxy_cache_valid 200 302 1h;
 #proxy_cache_valid 404 1m;
 proxy_redirect https://www.google.com/ /;
 proxy_cookie_domain google.com XXX.rhcloud.com;
 proxy_pass http://www.google.com;
 proxy_set_header Host "www.google.com";
 proxy_set_header Accept-Encoding "UTF-8";
 proxy_set_header User-Agent $http_user_agent;
 #proxy_set_header Accept-Language "zh-CN";
 #proxy_set_header Cookie "PREF=ID=047808f19f6de346:U=0f62f33dd8549d11:FF=2:LD=zh-CN:NW=1:TM=1325338577:LM=1332142444:GM=1:SG=2:S=rE0SyJh2w1IQ-Maw";
 sub_filter "www.google.com" "XXX.rhcloud.com";
 sub_filter_once off;
}
}
}

其中,XXX.rhcloud.com请自行替换为你的地址。

四、大功告成:执行sbin/nginx来测试,如果不能运行,请根据日志调试。如果正常运行,可将其加入自启动中,这里不再赘述。

时间: 2024-08-11 23:55:26

使用Openshift+Nginx代理Google实现方便跨栏的相关文章

使用nginx代理google

我的nginx服务器在香港,直接在nginx配置文件中添加一下内容就可以 proxy_cache_path  conf/cache/one  levels=1:2   keys_zone=one:10m max_size=10g; proxy_cache_key  "$host$request_uri"; server {     listen 80;     server_name g.example.com;     access_log  /var/log/nginx/acces

Linux10.12 Nginx代理

nginx代理图解 Nginx正向代理 Nginx正向代理使用场景并不多见. 需求场景1: 如果在机房中,只有一台机器可以联网,其他机器只有内网,内网的机器想用使用yum安装软件包,在能能联网的机器上配置一个正向代理即可. Nginx正向代理配置文件 server { listen 80 default_server; resolver 119.29.29.29; location / { proxy_pass http://$host$request_uri; } } 设置为默认主机,记得把之

搭建sftp服务+nginx代理

在公司,经常会用到sftp服务,比如两个公司对接生产项目,其中一方,要在sftp上上传pdf文件,另一方公司要在sftp服务器上用nginx代理直接下载pdf文件.下面就说说我在实际中应用到的sftp服务+nginx代理的配置方法: 一.环境: 192.168.16.12     centos6.5 在Centos 6.5环境使用系统自带的internal-sftp搭建SFTP服务器. 二.查看版本 查看openssh的版本,使用ssh -V 命令来查看openssh的版本,版本必须大于4.8p

Mogilefs配置以及nginx代理mogilefs

MogileFS:是一个开源的分布式存储,适用于存储海量的小文件.由LiveJournal旗下的Danga Interactive.这个公司还有memcache , MogileFS, Perlbal(http代理)等产品.其特点如下: 1,工用于应用层(用户空间):无须特殊的核心组件,因为基于http或都nfs,一般客户端都支持. 2,无单点故障所在,假设MySQL已经高可用并且tracker为多个节点.因为MySQL是否高可用,取决于MySQL. 3,自动文件复制,用户在上传一份数据都,tr

nginx代理配置文件模板示例

# 4核8g机器的nginx代理配置 # vim /usr/local/nginx/conf/nginx.conf user  nginx; worker_processes  8; worker_rlimit_nofile 102400; error_log  /data0/log/nginx/error.log  notice; pid        /data0/log/nginx/nginx.pid; events {     use epoll;     worker_connecti

使用nginx代理weblogic负载方案

之前一直用apache来做weblogic的前端,由于nginx对静态内容的出色性能,不得不转投nginx.这里就不 再写weblogic的安装了. 安装nginx nginx需要pcre做支持,一般系统都自带,当然可以自己下载高版本的源码包安装,建议大家使用高版本的pcre, 这样使用正则的时候会有更好的支持. 首先去http://wiki.nginx.org//NginxChs下载nginx,我用了0.7 # tar zxvf nginx-0.7.59.tar.gz # cd nginx-0

CentOS7利用DNS和Nginx代理做内网域名解析

1,为了将生产环境和开发区分开,方便开发,将利用DNS和Nginx代理做内网域名解析. 环境要求: 服务器:CentOS7 64位  IP:192.168.1.49 DNS Nginx1.1 客户端:CentOS7 64位 IP:192.168.1.45 Gitlab 2.1,安装DNS服务 [[email protected] ~]# yum install bind bind-bind-libs 2.2,修改/etc/named.conf配置文件 [[email protected] ~]#

nginx代理mogilefs集群实现

nginx代理mogilefs集群实现 一.实验拓扑 二.实验环境 三.实验步骤 1.节点部署 192.168.0.3 node1 [Nginx,Tracker,Storage,Mariadb] 192.168.0.4 node2 [Tracker,Storage] 192.168.0.5 node3 [Tracker,Storage] 2.初始化工作 配置好三台服务器IP,hosts文件等网络环境,时间同步以及以下的rpm包安装 注:以下操作在三个节点都执行 #下载rpm包(附件有提供) Mo

【Nginx】nginx 代理 Haproxy 怎么设置?

由于Haproxy是通过 url 正则匹配 识别 的,nginx代理到 haproxy需要设置 proxy_set_header Host 为 haproxy的目标 url 直接上配置 upstream rcm01_api_haproxy { server nscloud.rcm01.api.nsfocus.com; } server { listen 80; server_name nscloud.api.nsfocus.com; location / { proxy_pass http://