| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- # Cache zone
- proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=STATIC:10m inactive=7d use_temp_path=off;
- upstream nextjs {
- server 127.0.0.1:3000;
- }
- upstream palizvaniback {
- server palizvani.hghweb.ir;
- }
- server {
- listen 46.245.80.114:443 ssl http2 backlog=1048576 reuseport;
- # listen 80 default_server;
- include /config/ssl-nginx.conf;
- server_name palizvani.ir www.palizvani.ir ;
- add_header 'Access-Control-Allow-Origin' $http_origin always;
- add_header 'Access-Control-Allow-Credentials' 'true' always;
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
- add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization' always;
- proxy_buffering off;
- proxy_http_version 1.1;
- # Pass some headers to the downstream server, so it can identify the host.
- proxy_set_header Host $http_host;
- proxy_set_header Range $http_range;
- proxy_set_header If-Range $http_if_range;
- proxy_set_header X-Nginx-Proxy true;
- proxy_set_header X-Request-Id $request_id;
- proxy_set_header REMOTE_ADDR $remote_addr;
- #These header fields are required if your application is using Websockets.
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection $connection_upgrade;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- # Tell any web apps like Drupal that the session is HTTPS.
- proxy_set_header X-Forwarded-Proto $scheme;
- proxy_redirect off;
- #The proxy interface to the backend should not compress the data (lan connection).
- proxy_set_header Accept-Encoding "";
- server_tokens off;
- gzip on;
- gzip_proxied any;
- gzip_comp_level 4;
- gzip_types text/css application/javascript image/svg+xml;
- location / {
- # limit_req zone=req_zone_alaatv burst=100 nodelay;
- limit_req_status 429;
- # limit_conn con_zone_alaatv 64;
- proxy_pass_request_headers on;
- proxy_pass http://nextjs;
- }
- location ~ ^/api/(.*)$ {
- # limit_req zone=req_zone_soalaa burst=50 nodelay;
- limit_req_status 429;
- proxy_redirect off;
- proxy_set_header Host $host;
- proxy_set_header X-Forwarded-Host $host;
- proxy_set_header X-Forwarded-Server $host;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_http_version 1.1;
- proxy_pass_request_headers on;
- proxy_set_header Connection "keep-alive";
- proxy_store off;
- proxy_pass http://palizvaniback/api/$1?$query_string;
- }
- location ^~ /assets {
- add_header X-Cache-Status $upstream_cache_status always;
- proxy_pass_request_headers off;
- # proxy_cache php_cache;
- proxy_buffering on;
- proxy_cache_background_update on;
- proxy_cache_valid 200 206 302 304 3h;
- proxy_cache_key "$scheme$request_method$request_uri$is_args$args";
- proxy_cache_revalidate on;
- proxy_cache_min_uses 1;
- proxy_cache_methods GET HEAD;
- proxy_cache_lock on;
- proxy_ignore_headers Expires Set-Cookie;
- proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504 http_404 non_idempotent;
- proxy_hide_header Cache-Control;
- proxy_hide_header etag;
- proxy_cache_use_stale updating error timeout invalid_header http_500 http_502 http_503 http_504 http_403 http_429 http_404;
- proxy_pass http://nextjs;
- expires 365d;
- }
- location ~* \.(css|ico|woff|woff2|eot|svg|png|jpg|jpeg|gif|json|txt|mp4|mp3|webp|webm|pdf)$ {
- access_log off;
- log_not_found off;
- try_files $uri $uri/ =404;
- expires 7d;
- }
- # PWA
- location = /sw.js {
- proxy_pass_request_headers on;
- proxy_pass http://alaatv-front;
- proxy_hide_header Cache-Control;
- add_header Cache-Control no-cache;
- }
- location = /manifest.json {
- proxy_pass_request_headers on;
- proxy_pass http://alaatv-front;
- proxy_hide_header Cache-Control;
- add_header Cache-Control no-cache;
- }
- location ~ /workbox-.+\.js$ {
- proxy_pass_request_headers on;
- proxy_pass http://alaatv-front;
- proxy_hide_header Cache-Control;
- add_header Cache-Control no-cache;
- }
- }
|