码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2019-11-07 13:28:36      阅读:289      评论:0      收藏:0      [点我收藏+]

标签:scripts   位置   efault   apache   告诉   max   forward   ref   body   

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

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

标签:scripts   位置   efault   apache   告诉   max   forward   ref   body   

原文地址:https://www.cnblogs.com/yunian139/p/11811155.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!