nginx实现https的配置文件
Posted 一条寻找快乐的咸鱼
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx实现https的配置文件相关的知识,希望对你有一定的参考价值。
server { listen 80; server_name testplatform.itegou.com; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host:$server_port;
rewrite ^(.*)$ https://$host$1 permanent; #http强制跳转到https location / { proxy_pass http://192.168.1.10:8011; } } server { listen 443 ssl; server_name testplatform.itegou.com; ssl_certificate /usr/local/nginx/ssl/SSLCity.crt; ssl_certificate_key /usr/local/nginx/ssl/SSLCity.key; ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !RC4"; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host:$server_port; location / { 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_pass http://192.168.1.10:8011; } }
以上是关于nginx实现https的配置文件的主要内容,如果未能解决你的问题,请参考以下文章
Nginx——Nginx启动报错Job for nginx.service failed because the control process exited with error code(代码片段