nginx 配置文件配置(ssl和代理80端口)


server {
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

# 將80端口的鏈接轉發到8080端口

location /guohang {
proxy_pass http://localhost:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect default ;
client_max_body_size 200m;
}

 

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 = /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;
#}

}

 

#ssl證書配置

# HTTPS server
#
server {
listen 443 ssl;
server_name wechatguojihangyun.cn;  #ip綁定的域名
ssl_certificate /usr/local/nginx/cert/domainName.pem;   #自定義證書位置
ssl_certificate_key /usr/local/nginx/cert/domainName.key;  #自定義證書位置
ssl_session_cache shared:SSL:1m; 
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;

location / {
proxy_pass http://127.0.0.1:8080;
proxy_redirect http:// $scheme://;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
proxy_set_header WL-Proxy-SSL true; #weblogic啟效,告訴weblogic原始協議
proxy_set_header X-Forwarded-Proto https; #tomcat啟效,告訴tomcat原始協議
}
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM