日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

nginx反向代理https站点

發布時間:2025/3/19 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 nginx反向代理https站点 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

基本的代理配置就不說了 現在貼出配置并強調幾點容易出錯的問題。



user ? ? ? ? ? ? ?nginx;

worker_processes ?1;

error_log ?/var/log/nginx/error.log;

pid ? ? ? ?/var/run/nginx.pid;

events {

? ? worker_connections ?1024;

}

http {

? ? include ? ? ? /etc/nginx/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 ?/var/log/nginx/access.log ?main;

? ? sendfile ? ? ? ?on;

? ? keepalive_timeout ?65;



server {

? ? ? ? listen ? ? ? 80;

? ? ? ? server_name ?aaa.test.com;

? ? ? ? rewrite ^(.*) https://$server_name$1 permanent;

? ? }????????? ??##這一塊用來指定rewrite


? ? server {

? ? ? ? listen ? ? ? 443;

? ? ? ? server_name ?aaa.test.com;????????##如果后端是多vhost的server此處必須用真實域名。

? ? ? ? location / {

? ? ? ? ? ? ? ?proxy_pass https://172.16.160.131;? ? ?##realserver真實地址或域名

? ? ? ? ? ? ? ?proxy_set_header ?Host $host;

? ? ? ? ? ? ? ?proxy_set_header ?X-Real-IP ?$remote_addr;

? ? ? ? ? ? ? ?proxy_set_header ?X-Forwarded-For $proxy_add_x_forwarded_for;

? ? ? ? ? ? ? ?client_max_body_size 100m;

? ? ? ? ? ? ? ?client_body_buffer_size 128k;

? ? ? ? ? ? ? ?proxy_connect_timeout 300;

? ? ? ? ? ? ? ?proxy_send_timeout 300;

? ? ? ? ? ? ? ?proxy_read_timeout 300;

? ? ? ? ? ? ? ?proxy_buffer_size 4k;

? ? ? ? ? ? ? ?proxy_buffers 4 32k;

? ? ? ? ? ? ? ?proxy_busy_buffers_size 64k;

? ? ? ? ? ? ? ?proxy_temp_file_write_size 64k;

? ? ? ? ? ? ? ?add_header X-Frame-Options SAMEORIGIN;

? ? ? }


? ? ? ssl ? ? ? ? ? ? ? ? ?on;

? ? ? ssl_certificate ? ? ?/etc/nginx/cert/server.crt;?????##此處是realserver的站點證書,用自簽返回的就是自簽。

? ? ? ssl_certificate_key ?/etc/nginx/cert/server.key;

? ? ? ssl_session_timeout ?5m;

? ? ? ssl_protocols ?SSLv3 TLSv1;

? ? ? ssl_ciphers ?ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;

? ? ? ssl_prefer_server_ciphers ? on;

? ? ? error_page ? 500 502 503 504 ?/50x.html;

? ? ? location = /50x.html {

? ? ? ? ? root ? html;

? ? ? }

? ?}





? ? include /etc/nginx/conf.d/*.conf;


}


本文轉自 轉身撞墻角 51CTO博客,原文鏈接:http://blog.51cto.com/chentianwang/1825936

總結

以上是生活随笔為你收集整理的nginx反向代理https站点的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。