Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 2.90 KB | None | 0 0
  1. # For more information on configuration, see:
  2. #   * Official English Documentation: http://nginx.org/en/docs/
  3. #   * Official Russian Documentation: http://nginx.org/ru/docs/
  4.  
  5. user admin;
  6. worker_processes auto;
  7. error_log /var/log/nginx/error.log;
  8. pid /run/nginx.pid;
  9.  
  10. # Load dynamic modules. See /usr/share/nginx/README.dynamic.
  11. include /usr/share/nginx/modules/*.conf;
  12.  
  13. events {
  14.     worker_connections 1024;
  15. }
  16.  
  17. http {
  18.     log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
  19.                       '$status $body_bytes_sent "$http_referer" '
  20.                       '"$http_user_agent" "$http_x_forwarded_for"';
  21.  
  22.     access_log  /var/log/nginx/access.log  main;
  23.  
  24.     sendfile            on;
  25.     tcp_nopush          on;
  26.     tcp_nodelay         on;
  27.     keepalive_timeout   65;
  28.     types_hash_max_size 2048;
  29.  
  30.     include             /etc/nginx/mime.types;
  31.     default_type        application/octet-stream;
  32.  
  33.     # Load modular configuration files from the /etc/nginx/conf.d directory.
  34.     # See http://nginx.org/en/docs/ngx_core_module.html#include
  35.     # for more information.
  36.     include /etc/nginx/conf.d/*.conf;
  37.  
  38.     server {
  39.         server_name  example.com;
  40.         root         /app;
  41.         # Load configuration files for the default server block.
  42.         include /etc/nginx/default.d/*.conf;
  43.  
  44.         location / {
  45.                 proxy_pass http://0.0.0.0:8080;
  46.                 proxy_http_version 1.1;
  47.                 proxy_set_header Upgrade $http_upgrade;
  48.                 proxy_set_header Connection 'upgrade';
  49.                 proxy_set_header Host $host;
  50.                 proxy_cache_bypass $http_upgrade;
  51.  
  52.         }
  53.  
  54.         location /api {
  55.                 proxy_pass http://0.0.0.0:3001;
  56.                 proxy_http_version 1.1;
  57.                 proxy_set_header Upgrade $http_upgrade;
  58.                 proxy_set_header Connection 'upgrade';
  59.                 proxy_set_header Host $host;
  60.                 proxy_cache_bypass $http_upgrade;
  61.         }
  62.  
  63.         error_page 404 /404.html;
  64.             location = /40x.html {
  65.         }
  66.  
  67.         error_page 500 502 503 504 /50x.html;
  68.             location = /50x.html {
  69.         }
  70.    
  71.     listen [::]:443 ssl ipv6only=on; # managed by Certbot
  72.     listen 443 ssl; # managed by Certbot
  73.     ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
  74.     ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
  75.     include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
  76.     ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
  77.  
  78.  
  79. }
  80.  
  81.  
  82.  
  83.     server {
  84.  
  85.         if ($host = example.com) {
  86.            return 301 https://$host$request_uri;
  87.         } # managed by Certbot
  88.  
  89.         listen       80 default_server;
  90.         listen       [::]:80 default_server;
  91.         server_name  example.com;
  92.     return 404; # managed by Certbot
  93.  
  94.  
  95. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement