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原始协议
}
}