-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
52 lines (43 loc) · 1.18 KB
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
server {
listen 5000;
root /usr/share/nginx/html;
location / {
# Serve only WebP images
types {
image/webp webp;
}
default_type image/webp;
# Serve the WebP image if it exists, otherwise fall back to the original image
try_files $uri =404;
# Set caching headers
expires 1y;
add_header Cache-Control "public";
}
location /handler {
# Pass requests to the Go API running on localhost:3000
proxy_pass http://localhost:3000;
# Set headers to forward the original host and IP
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
# Set up buffering for performance tuning
proxy_buffering on;
proxy_buffer_size 1m;
proxy_buffers 8 1m;
proxy_busy_buffers_size 1m;
proxy_max_temp_file_size 0;
proxy_read_timeout 300s;
# performance tuning for client
client_body_buffer_size 1M;
}
server_tokens off;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options nosniff;
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 0;
gzip_types image/webp;
}