Skip to content

Commit dc44870

Browse files
author
WuJun
committed
feat: use ssl.
1 parent f236261 commit dc44870

File tree

2 files changed

+53
-22
lines changed

2 files changed

+53
-22
lines changed

docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ services:
3737
volumes:
3838
- './nginx:/etc/nginx/sites-enabled'
3939
- './nginx/default.conf:/etc/nginx/conf.d/default.conf'
40+
# letsencrypt will put generated pems under /etc/letsencrypt/live/yourdomain.com, copy them to nginx container.
41+
# - '/etc/letsencrypt/live/yourdomain.com/fullchain.pem:/etc/nginx/ssl/fullchain.pem'
42+
# - '/etc/letsencrypt/live/yourdomain.com/privkey.pem:/etc/nginx/ssl/privkey.pem'
4043
links:
4144
- parse-dashboard
4245
- parse

nginx/default.conf

Lines changed: 50 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,8 @@
1-
# HTTP - redirect all requests to HTTPS
2-
# server {
3-
# # listen 80;
4-
# # listen [::]:80 default_server ipv6only=on;
5-
# # return 301 https://$host$request_uri;
6-
# }
1+
### without letsencrypt start ###
72

8-
# HTTPS - proxy requests to /parse-server/
93
# through to Parse Server
104
server {
11-
# listen 443 ssl;
125
listen 80;
13-
# server_name chigua.live www.chigua.live;
14-
15-
# root /usr/share/nginx/html;
16-
# index index.html index.htm;
17-
18-
# ssl on;
19-
# # Use certificate and key provided by Let's Encrypt:
20-
# ssl_certificate /etc/nginx/ssl/chained.pem;
21-
# ssl_certificate_key /etc/nginx/ssl/domain.key;
22-
# ssl_session_timeout 5m;
23-
# ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
24-
# ssl_prefer_server_ciphers on;
25-
# ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
266

277
# Pass requests for /parse/ to Parse Server instance at localhost:1337
288
location /api/ {
@@ -44,4 +24,52 @@ server {
4424
proxy_set_header Host $http_host;
4525
proxy_redirect off;
4626
}
47-
}
27+
}
28+
29+
30+
#------------------ dividing line for using ssl -------------------#
31+
32+
### without letsencrypt end ###
33+
34+
35+
### the final sample with letsencrypt start ###
36+
37+
# server {
38+
# listen 80;
39+
# listen [::]:80 default_server ipv6only=on;
40+
# return 301 https://$host$request_uri;
41+
# }
42+
43+
# server {
44+
# listen 443 ssl;
45+
# server_name yourdomain.com www.yourdomain.com;
46+
47+
48+
# ssl on;
49+
# ssl_certificate /etc/nginx/ssl/fullchain.pem;
50+
# ssl_certificate_key /etc/nginx/ssl/privkey.pem;
51+
# ssl_session_timeout 5m;
52+
# ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
53+
# ssl_prefer_server_ciphers on;
54+
# ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
55+
56+
# location /api/ {
57+
# proxy_pass http://parse:1337/;
58+
# proxy_set_header X-Real-IP $remote_addr;
59+
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
60+
# proxy_set_header X-NginX-Proxy true;
61+
# proxy_ssl_session_reuse off;
62+
# proxy_set_header Host $http_host;
63+
# proxy_redirect off;
64+
# }
65+
66+
# location / {
67+
# proxy_pass http://parse-dashboard:4040/;
68+
# proxy_set_header Host $host;
69+
# proxy_set_header X-Real-IP $remote_addr;
70+
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
71+
# proxy_set_header X-Forwarded-Proto https;
72+
# }
73+
# }
74+
75+
### the final sample with letsencrypt end ###

0 commit comments

Comments
 (0)