-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
88 lines (73 loc) · 2.06 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
worker_processes auto;
events {
worker_connections 4096;
multi_accept on;
use epoll;
}
http {
upstream backend {
server localhost:8888;
#server other_go_service_addr:8888;
# Add more Go service instances as needed
}
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
keepalive_requests 10000;
server_tokens off;
gzip on;
gzip_comp_level 5;
gzip_min_length 256;
gzip_types text/plain text/css text/javascript application/javascript application/json;
fastcgi_buffer_size 32k;
fastcgi_buffers 8 32k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k;
fastcgi_read_timeout 300s;
client_body_timeout 10s;
client_header_timeout 10s;
send_timeout 10s;
open_file_cache max=2000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors off;
# Configure connection pooling
upstream php-fpm {
server unix:/var/run/php/php8.2-fpm.sock;
# Add more PHP-FPM servers if needed
}
server {
listen 80;
server_name example.com;
location / {
#Golang proxy. Traffic limiter
proxy_pass http://backend;
proxy_set_header Host $host;
}
}
server {
listen 8010;
server_name example.com;
root /usr/share/nginx/html/;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass php-fpm;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
access_log off;
}
}
}