Skip to content

Instantly share code, notes, and snippets.

@swdream
Last active September 11, 2018 07:58
Show Gist options
  • Save swdream/5757fdbff705cec1d1a6d61488777353 to your computer and use it in GitHub Desktop.
Save swdream/5757fdbff705cec1d1a6d61488777353 to your computer and use it in GitHub Desktop.

bật file html khác

    location / {
       rewrite ^(.*)$ /503.html last;
    }

    location = /503.html {
                root /usr/share/nginx/html;
    }

Trả về response:

    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" }}';
    }

gzip response

    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/

Cho phép access từ một address khác

# 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' ";

k8s

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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment