编译Nginx反代Inoreader

最近Inoreader实在是太慢了,无奈折腾了一个反向代理,记录下笔记
编译安装Nginx

groupadd www
useradd -s /sbin/nologin -g www www
wget http://nginx.org/download/nginx-1.6.2.tar.gz
tar -xvf nginx-1.6.2.tar.gz
git clone https://github.com/cuber/ngx_http_google_filter_module
git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module
git clone https://github.com/alibaba/nginx-http-concat.git
cd nginx-1.6.2
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6 --add-module=/root/ngx_http_substitutions_filter_module --add-module=/root/nginx-http-concat
make && make install
ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx
wget -c https://dl.dropboxusercontent.com/u/3052739/files/shell/nginx/init.d.nginx
cp init.d.nginx /etc/init.d/nginx
chmod +x /etc/init.d/nginx
cd /usr/local/nginx/conf
wget -c https://dl.dropboxusercontent.com/u/3052739/files/shell/nginx/nginx.conf
mkdir /home/wwwlogs/
chmod 777 /home/wwwlogs
mkdir /home/wwwroot/
chmod +w /home/wwwroot
chown -R www:www /home/wwwroot
mkdir /usr/local/nginx/conf/vhost
/etc/init.d/nginx restart

反向代理配置文件

proxy_temp_path   /home/wwwroot/proxy_temp_dir 1 2;
proxy_cache_path /home/wwwroot/proxy_cache_dir levels=1:2 keys_zone=inoreader:50m inactive=1d max_size=1g;

log_format  inoreader.aenes.com  '$remote_addr - $remote_user [$time_local] $request '
             '$status $body_bytes_sent $http_referer '
             '$http_user_agent $http_x_forwarded_for';
server{
    listen 80;
    server_name inoreader.aenes.com;
    rewrite ^(.*) https://inoreader.aenes.com$1 permanent;
    }
server{
    listen 443;
    server_name inoreader.aenes.com;

    ssl on;
    ssl_certificate /root/cert/inoreader.crt;
    ssl_certificate_key /root/cert/inoreader.key;
    ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ALL:-ADH:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP;

    location /{
    proxy_redirect https://www.inoreader.com/ https://inoreader.aenes.com/;
    proxy_pass https://www.inoreader.com/;
    proxy_set_header Accept-Encoding "";
    subs_filter 'href="/images' 'href="https://dn-inoreader.qbox.me/images';
    subs_filter 'fonts.googleapis.com' 'fonts.lug.ustc.edu.cn';
    subs_filter 'www.inoreader.com' 'inoreader.aenes.com';
    subs_filter 'href="/m' 'href="https://inoreader.aenes.com/m';
    subs_filter 'src="/include' 'src="https://dn-inoreader.qbox.me/include';
    subs_filter 'src="/innoworks' 'src="https://dn-inoreader.qbox.me/innoworks';
    subs_filter 'href="/include' 'src="https://dn-inoreader.qbox.me/include';
    #subs_filter 'href="/css' 'src="https://dn-inoreader.qbox.me/css';
    subs_filter 'src="/images' 'src="https://dn-inoreader.qbox.me/images';

    proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
    client_max_body_size       10m;
    client_body_buffer_size    128k;

    proxy_connect_timeout      90;
    proxy_send_timeout         90;
    proxy_read_timeout         90;

    proxy_cache_key "$scheme://$host$request_uri";
    proxy_cache inoreader; 
    proxy_cache_valid 200 302 12h; 
    proxy_cache_valid 301 1d; 
    proxy_cache_valid any 1h;
    proxy_cache_bypass $cookie_user;
    proxy_no_cache $cookie_user; 

    proxy_buffer_size          4k;
    proxy_buffers              4 32k;
    proxy_busy_buffers_size    64k;
    proxy_temp_file_write_size 64k;
        }
    access_log  /home/wwwlogs/inoreader.aenes.com.log  inoreader.aenes.com;
    }

最后,反向代理地址:https://inoreader.aenes.com/

编译Nginx反代Inoreader》上有一条评论

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注