55-nginx_conf_https, nginx配置https
Posted 认真的coder
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了55-nginx_conf_https, nginx配置https相关的知识,希望对你有一定的参考价值。
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events
worker_connections 1024;
http
include 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 logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
# HTTPS server
#
server
listen 443 ssl;
server_name ql.gaojilaochacang.com;
ssl_certificate /home/gpkey/gp.pem;
ssl_certificate_key /home/gpkey/gp.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_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto https;
proxy_http_version 1.1;
# for websocket
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
server
listen 80;
server_name ql.gaojilaochacang.com;
#将请求转成https
rewrite ^(.*)$ https://$host$1 permanent;
以上是关于55-nginx_conf_https, nginx配置https的主要内容,如果未能解决你的问题,请参考以下文章