Untitled
unknown
plain_text
2 years ago
2.9 kB
4
Indexable
# "keys_zone=name:size” --> size: 10MB/0.125kB ~ 80000 cache keys # levels --> two‑level directory hierarchy, max 3 # inactive --> removed items if not accessed after 7 days # use_temp_path=off --> write files directly to the cache dir and avoid unnecessary copying of data to a temp storage first proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=STATIC:10m inactive=7d use_temp_path=off; # skip header Set-Cookie proxy_ignore_headers Set-Cookie; # redirect to upstream with header X-No-Cache proxy_no_cache $http_x_no_cache; upstream nextjs_upstream { server next_app:3000; } server { # default port 80 listen 80 default_server; # As this's default server and will handle all requests that aren't matched by other server blocks --> we don’t need a name server_name _; # The NGINX version doesn't appear in the response headers server_tokens off; # set root root /var/www/html/frontend; # set log error_log /var/log/nginx/error.log; access_log /var/log/nginx/access.log; # compressing files before sending, gzip works best on text-heavy file formats such as: css, js, svg, xml, etc. gzip on; gzip_proxied any; gzip_comp_level 4; gzip_types text/css application/javascript image/svg+xml; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; location /_next/static { # use cache zone STATIC to cache any file whose path contains the /_next/static dir proxy_cache STATIC; # then pass all requests to nextjs_upstream proxy_pass http://nextjs_upstream; # For testing cache - remove before deploying to production add_header X-Cache-Status $upstream_cache_status; } location /static { proxy_cache STATIC; proxy_ignore_headers Cache-Control; proxy_cache_valid 60m; proxy_pass http://nextjs_upstream; # For testing cache - remove before deploying to production add_header X-Cache-Status $upstream_cache_status; } location /_next/image { # proxy pass to the above upstream proxy_pass http://nextjs_upstream; } location / { # proxy pass to the above upstream proxy_pass http://nextjs_upstream; } # laravel backend location ~ /api { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { root /var/www/html/api/public; try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass laravel:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_hide_header X-Powered-By; } location ~ /\.ht { deny all; } }
Editor is loading...