location / {
rewrite ^(.*)$ /503.html last;
}
location = /503.html {
root /usr/share/nginx/html;
}
location /api {
proxy_pass http://127.0.0.1:9000;
default_type application/json;
return 503 '{"success":false, "warning":{ "code": 503, "message": "We are carrying out server maintenance from 00:00:00 ~ 01:00:00 Today. Sorry for this inconvenience. In urgent case, please contact us via: https://docs.google.com/a/septeni-original.co.jp/forms/d/1060oyHdSBnQiNDag0kR5UX_BCt9KDXYL3TTN72wv1uQ/viewform" }}';
}
location /api {
proxy_pass http://127.0.0.1:9000;
gzip on;
gzip_comp_level 9;
gzip_min_length 256;
gzip_types application/json;
}
Có thể đặt trong server {}
hoặc location
block.
https://docs.nginx.com/nginx/admin-guide/web-server/compression/
# security configure
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' apis.google.com ssl.gstatic.com accounts.google.com www.google-analytics.com; img-src 'self' www.google-analytics.com stats.g.doubleclick.net data:; style-src 'self' 'unsafe-inline' apis.google.com ssl.gstatic.com accounts.google.com www.google-analytics.com; font-src 'self' data:; frame-src apis.google.com ssl.gstatic.com accounts.google.com www.google-analytics.com; connect-src xxx; object-src 'none' ";
cat docker-compose.yml
version: '2'
services:
admin-app:
build: ./admin-app
ports:
- "9000:9000"
links:
- redis_db:redis
- orientdb:orientdb:2.1.14
nginx:
restart: always
build: ./nginx/
ports:
- "80:80"
links:
- admin-app:admin-app
redis_db:
image: redis
ports:
- "6379:6379"
orientdb:
image: orientdb:2.1.14
ports:
- "2480:2480"