Advertisement
thiagofaioli

Proxy NGINX Novu self-hosting

Mar 22nd, 2024 (edited)
839
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 2.42 KB | None | 1 0
  1. server {
  2.     listen 80;
  3.  
  4.     client_max_body_size 20M;
  5.  
  6.     server_name mydns.com.br xxx.xxx.xxx.xxx;
  7.  
  8.     access_log  /var/log/nginx/novu_access.log;
  9.     error_log /var/log/nginx/novu_error.log;
  10.  
  11.     location / {
  12.             proxy_pass http://localhost:4200;
  13.             proxy_http_version 1.1;
  14.             if ($request_method = OPTIONS) {
  15.               add_header 'Access-Control-Allow-Origin' '*';
  16.               add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE';
  17.               add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization';
  18.               return 200;
  19.             }
  20.             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  21.             proxy_set_header Host $host;
  22.             proxy_set_header Upgrade $http_upgrade;
  23.             proxy_set_header Connection "upgrade";
  24.     }
  25.  
  26.     location /api {
  27.             proxy_pass http://localhost:3000/api;
  28.             proxy_http_version 1.1;
  29.             add_header 'Access-Control-Allow-Origin' '*';
  30.             add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE';
  31.             add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization';
  32.             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  33.             proxy_set_header Host $host;
  34.             proxy_set_header Upgrade $http_upgrade;
  35.             proxy_set_header Connection "upgrade";
  36.     }
  37.  
  38.     location /ws {
  39.             proxy_pass http://localhost:3002/ws;
  40.             proxy_http_version 1.1;
  41.             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  42.             proxy_set_header Host $host;
  43.             proxy_set_header Upgrade $http_upgrade;
  44.             proxy_set_header Connection "upgrade";
  45.     }
  46.  
  47.     location /widget {
  48.             proxy_pass http://localhost:4500/widget;
  49.             proxy_http_version 1.1;
  50.             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  51.             proxy_set_header Host $host;
  52.             proxy_set_header Upgrade $http_upgrade;
  53.             proxy_set_header Connection "upgrade";
  54.     }
  55.  
  56.     location /socket.io/ {
  57.             proxy_pass http://localhost:3002;
  58.             proxy_http_version 1.1;
  59.             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  60.             proxy_set_header Host $host;
  61.             proxy_set_header Upgrade $http_upgrade;
  62.             proxy_set_header Connection "upgrade";
  63.     }
  64.  
  65. # proxy_headers_hash_max_size 512;
  66. # proxy_headers_hash_bucket_size 128;
  67. }
  68.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement