nginx https反向代理域名https

发布时间 2023-04-07 17:23:13作者: woaibaobei

server {
#listen 80;
listen 443 ssl http2;

server_name www.fxdd65d.cc;
index index.php index.html index.htm default.php default.htm default.html;
#root /var/www/server.bikacoins.vip/public/front;

#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
#error_page 404/404.html;
ssl_certificate /usr/local/nginx/cert/www.fxdd0e66.cc/fullchain.crt;
ssl_certificate_key /usr/local/nginx/cert/www.fxdd0e66.cc/private.key;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
add_header Strict-Transport-Security "max-age=31536000";
#error_page 497 https://$host$request_uri;

#HTTP_TO_HTTPS_START
if ($server_port !~ 443){
rewrite ^(/.*)$ https://$host$1 permanent;
}


location / {
proxy_pass https://github.com;
#proxy_ssl_certificate /usr/local/nginx/cert/www.fxdd0e66.cc/fullchain.crt;
#proxy_ssl_certificate_key /usr/local/nginx/cert/www.fxdd0e66.cc/private.key;
#proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#proxy_ssl_ciphers HIGH:!aNULL:!MD5;
#proxy_ssl_verify_depth 2;
#proxy_ssl_session_reuse on;
resolver 8.8.8.8;
proxy_ssl_server_name on;
proxy_set_header Referer https://www.fxdd65d.cc;
proxy_set_header Host github.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

access_log /var/log/www.log;
error_log /var/log/www.error.log;
}