Skip to content

Commit

Permalink
update nginx ssl
Browse files Browse the repository at this point in the history
  • Loading branch information
lcp0578 committed Jan 31, 2018
1 parent 0cb6e88 commit 9fe3b23
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 13 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
- [nginx conf](src/Nginx/nginx.conf.md)
- [vhost conf](src/Nginx/vhost.md)
- [proxy_pass](src/Nginx/proxy_pass.md)
- [ssl](src/Nginx/ssl.md)
27. [Code::Blocks](CodeBlocks.md)
- [Code::Blocks shortcut](src/CodeBlocks/shortcut.md)
28. [Ubuntu](src/Ubuntu/README.md)
Expand Down
3 changes: 2 additions & 1 deletion src/Nginx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
- [nginx basic](nginx_basic.md)
- [nginx conf](nginx.conf.md)
- [vhost conf](vhost.md)
- [proxy_pass](proxy_pass.md)
- [proxy_pass](proxy_pass.md)
- [ssl](ssl.md)
57 changes: 45 additions & 12 deletions src/Nginx/ssl.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,49 @@
## ssl

server {
listen 443;
server_name www.domain.com; #填写绑定证书的域名
ssl on;
ssl_certificate /path/1_www.domain.com_bundle.crt;
ssl_certificate_key /path/2_www.domain.com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置
ssl_prefer_server_ciphers on;
location / {
- 开启ssl的额外配置

server {
listen 443;
server_name www.domain.com; #填写绑定证书的域名
ssl on;
ssl_certificate /path/1_www.domain.com_bundle.crt;
ssl_certificate_key /path/2_www.domain.com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置
ssl_prefer_server_ciphers on;
location / {

}
}
}
- 80请求转到443

server {
listen 80;
listen [::]:80;
server_name www.domain.com;
rewrite ^(.*) https://$server_name$1 permanent;
}
- 80与443共存

server
{
listen 80;
#listen [::]:80;
listen 443 ssl;
server_name www.domain.com;

# ssl on; // 需要注释掉
ssl_certificate /home/www/ssl/1_www.domain.com_bundle.crt;
ssl_certificate_key /home/www/ssl/2_www.domain.com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;

location /
{
proxy_pass http://127.0.0.1:12001;
}

}

0 comments on commit 9fe3b23

Please sign in to comment.