-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
60 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,58 @@ | ||
upstream api { | ||
server backend:8080; | ||
} | ||
|
||
server { | ||
listen 80; | ||
server_name www.sharenote.shop; | ||
#server_name localhost; | ||
charset utf-8; | ||
|
||
# SSL | ||
# Allow only for register SSL (Certbot) | ||
location /.well-known/acme-challenge/ { | ||
allow all; | ||
root /var/www/certbot; | ||
http { | ||
upstream api { | ||
server backend:8080; | ||
} | ||
|
||
# Http로 들어온 요청을 Https로 리다이렉트 | ||
location / { | ||
return 301 https://$host$request_uri; | ||
} | ||
} | ||
|
||
server { | ||
listen 443 ssl; | ||
server_name www.sharenote.shop; | ||
|
||
ssl_certificate /etc/letsencrypt/live/www.sharenote.shop/fullchain.pem; # ssl 인증서 사용 | ||
ssl_certificate_key /etc/letsencrypt/live/www.sharenote.shop/privkey.pem; | ||
include /etc/letsencrypt/options-ssl-nginx.conf; | ||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; | ||
|
||
# 요청받은 uri로 연결 eg) http://127.0.0.1/login | ||
location /api/ { | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
proxy_set_header Host $http_host; | ||
proxy_redirect off; | ||
proxy_pass http://api; | ||
server { | ||
listen 80; | ||
server_name www.sharenote.shop; | ||
#server_name localhost; | ||
charset utf-8; | ||
|
||
# SSL | ||
# Allow only for register SSL (Certbot) | ||
location /.well-known/acme-challenge/ { | ||
allow all; | ||
root /var/www/certbot; | ||
} | ||
|
||
# Http로 들어온 요청을 Https로 리다이렉트 | ||
location / { | ||
return 301 https://$host$request_uri; | ||
} | ||
} | ||
|
||
server { | ||
listen 443 ssl; | ||
server_name www.sharenote.shop; | ||
|
||
# ignore cache frontend | ||
location ~* (service-worker\.js)$ { | ||
add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; | ||
expires off; | ||
proxy_no_cache 1; | ||
} | ||
# ssl_certificate /etc/letsencrypt/live/www.sharenote.shop/fullchain.pem; # ssl 인증서 사용 | ||
# ssl_certificate_key /etc/letsencrypt/live/www.sharenote.shop/privkey.pem; | ||
# include /etc/letsencrypt/options-ssl-nginx.conf; | ||
# ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; | ||
|
||
# 요청받은 uri로 연결 eg) http://127.0.0.1/login | ||
location /api/ { | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
proxy_set_header Host $http_host; | ||
proxy_redirect off; | ||
proxy_pass http://api; | ||
} | ||
|
||
location / { | ||
root /usr/share/nginx/html; #여기에 위치한 정적 파일을 제공 | ||
try_files $uri $uri/ /index.html?q=$uri&$args; | ||
} | ||
|
||
# ignore cache frontend | ||
location ~* (service-worker\.js)$ { | ||
add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; | ||
expires off; | ||
proxy_no_cache 1; | ||
} | ||
|
||
location / { | ||
root /usr/share/nginx/html; #여기에 위치한 정적 파일을 제공 | ||
try_files $uri $uri/ /index.html?q=$uri&$args; | ||
} | ||
|
||
|
||
} | ||
} |