亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 18836 | 回復: 6
打印 上一主題 下一主題

Nginx反向代理https求助 [復制鏈接]

論壇徽章:
0
跳轉到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2009-05-15 14:37 |只看該作者 |倒序瀏覽
想請教一下論壇里的高手

如何配置nginx去反向代理遠端的https下的web服務器。下面是我的配置文件nginx.conf的內容,請大家指正

#cat nginx.conf

user  nginx nginx;
worker_processes  2;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
error_log  logs/error.log  info;

pid        logs/nginx.pid;


events {
    worker_connections  4096;
#    use kqueue;
}


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;
    gzip_min_length 1100;
    gzip_buffers 4 8k;
    gzip_types text/plain;

    output_buffers 1 32k;
    postpone_output 1460;

    tcp_nodelay on;
    #send_lowat 12000;

    keepalive_timeout 75 20;

upstream xp.test.com {
server 192.168.6.8:80;
}

    server {
        listen       80;
        server_name  192.168.44.151;
        root html;
        #charset koi8-r;
        charset utf-8;
        access_log  logs/host.access.log;

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

       location / {
       proxy_pass http://xp.test.com;
       proxy_set_header X-Real-IP $remote_addr;
       }

       if (-d $request_filename){
       rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent;
       }

       location /nginx_status {
       stub_status on;
       access_log off;
       }

include enable_php;

        #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   html;
        }

        # 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$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # 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  localhost;

        ssl                  on;
        ssl_certificate      /usr/local/nginx/conf/server.crt;
        ssl_certificate_key  /usr/local/nginx/conf/server.key;
        error_page 497 "https://$host$uri?$args";
        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 / {
    #        root   html;
    #        index  index.html index.htm;
        include proxy.conf;
        auth_basic "status";
        }
    }

}

對上面的配置文件做一些基本的解釋:我的nginx代理服務器ip地址為192.168.44.151,真實的服務器為192.168.6.8.現在的問題是,我的思路為用戶請求到達nginx代理服務器的80端口后,代理將請求轉發(fā)至遠端web服務器的80端口(因為首頁未加密,但首頁上有進入被加密內容的鏈接),當用戶在點擊首頁上被加密內容鏈接后便進入加密頁面,即https。

以上的配置能夠正?吹椒羌用軆热荩且坏c擊含有加密內容的鏈接后,便會報錯。內容為“無法顯示該頁面”,遠端服務器的證書和私鑰文件均已上傳至這臺nginx上

想問一下,上面的配置中是哪里配置的有問題呢?

附:
#cat proxy.conf
#proxy_set_header X-Forwarded-For $remote_addr;
#proxy_set_header REMOTE_ADDR $remote_addr;
#proxy_set_header RealIP $remote_addr;
proxy_set_header Host $proxy_host;
#proxy_set_header Accept-Encoding '';

#proxy_hide_header X-Cache;
#proxy_hide_header X-Powered-By;
#proxy_hide_header Last-Modified;
#proxy_hide_header Date;
#proxy_hide_header Content-Length;
#proxy_hide_header Content-Language;
#proxy_hide_header Cache-Control;

#proxy_pass_header Server;

client_max_body_size    8m;
proxy_connect_timeout   15s;
proxy_send_timeout      1m;
proxy_read_timeout      1m;
proxy_temp_file_write_size 1024m;
proxy_buffer_size         32k;
proxy_buffers             4 32k;
proxy_busy_buffers_size 64k;

proxy_ignore_client_abort on;

proxy_next_upstream error timeout invalid_header http_503;

論壇徽章:
0
2 [報告]
發(fā)表于 2009-05-15 15:59 |只看該作者
加密? 443端口的那個?

論壇徽章:
0
3 [報告]
發(fā)表于 2009-05-15 16:11 |只看該作者
首先感謝回帖

我現在的情況是,我的151上的nginx可以反向代理真實服務器首頁上非加密的內容,且瀏覽這些內容都是正常的。同時瀏覽首頁也是正常的

但首頁上有一些連接,點擊之后便會被https加密,所以當點擊這些鏈接之后,便會出現 無法顯示該頁面 的報錯內容

不知道該如何去解決這些問題

感謝每一位回帖的兄弟

論壇徽章:
0
4 [報告]
發(fā)表于 2009-05-15 19:04 |只看該作者
樓主,你看看我這個是否能幫到您.不是廣告.
http://my.benorz.org/index.php/more/62
我之前也做nginx ssl的.因為公司的業(yè)務系統買了一個ssl.后端的服務器要做集群.所以才要這么做.呵呵

論壇徽章:
0
5 [報告]
發(fā)表于 2009-05-16 17:02 |只看該作者

回復 #1 ProfessorTian 的帖子

需要一個保持時間的

論壇徽章:
0
6 [報告]
發(fā)表于 2009-05-18 12:51 |只看該作者
想問一下

nginx代理的443端口和被代理的web服務器的443端口之間是個什么關系

當nginx代理遠程web的443端口時,這個過程是什么樣的

請高手指點

論壇徽章:
0
7 [報告]
發(fā)表于 2013-06-25 16:31 |只看該作者
本帖最后由 心若寒江雪 于 2013-06-25 16:32 編輯

請問一下你這個弄出來了嗎?
如果弄出來了幫我看看吧
http://www.72891.cn/thread-4087536-1-1.html
多謝了
回復 1# ProfessorTian


   
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復

  

北京盛拓優(yōu)訊信息技術有限公司. 版權所有 京ICP備16024965號-6 北京市公安局海淀分局網監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯網協會會員  聯系我們:huangweiwei@itpub.net
感謝所有關心和支持過ChinaUnix的朋友們 轉載本站內容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP