-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.conf
More file actions
69 lines (57 loc) · 1.72 KB
/
default.conf
File metadata and controls
69 lines (57 loc) · 1.72 KB
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
# Nginx server block for StoneScriptPHP
server {
listen 8000;
server_name _;
root /app/public;
index index.php;
# Logging
access_log /var/log/nginx/stonescriptphp-access.log;
error_log /var/log/nginx/stonescriptphp-error.log;
# Security: Deny access to hidden files
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
# Main location block
location / {
# Try to serve file directly, fallback to index.php
try_files $uri $uri/ /index.php$is_args$args;
}
# PHP-FPM handling
location ~ \.php$ {
# Security: Don't execute PHP files that don't exist
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
# Increase timeouts for long-running requests
fastcgi_read_timeout 300;
fastcgi_send_timeout 300;
# Buffer settings
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
# Deny access to composer files
location ~ /composer\.(json|lock)$ {
deny all;
}
# Deny access to .env files
location ~ /\.env {
deny all;
}
# Cache static assets
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
access_log off;
}
# Health check endpoint (bypass PHP for performance)
location = /health {
try_files $uri /index.php$is_args$args;
}
}