forked from Buthzz/trevio-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.nginx.conf
More file actions
102 lines (87 loc) · 2.85 KB
/
Copy path.nginx.conf
File metadata and controls
102 lines (87 loc) · 2.85 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Nginx Configuration for Trevio Project
# Place this in: /etc/nginx/sites-available/trevio-dev
# Symlink to: /etc/nginx/sites-enabled/trevio-dev
server {
listen 80;
listen [::]:80;
server_name trevio-dev.mfjrxn.eu.org;
# Document root should point to public folder
root /var/www/trevio-dev/public;
index index.php index.html;
# Charset
charset utf-8;
# Logging
access_log /var/log/nginx/trevio-dev-access.log;
error_log /var/log/nginx/trevio-dev-error.log;
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
# Disable access to hidden files
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
# Disable access to sensitive files
location ~* \.(env|sql|log|md)$ {
deny all;
access_log off;
log_not_found off;
}
# Main location block
location / {
try_files $uri $uri/ /index.php?url=$uri&$args;
}
# PHP-FPM configuration
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
# Additional PHP settings
fastcgi_param PHP_VALUE "upload_max_filesize=10M \n post_max_size=10M";
fastcgi_read_timeout 300;
}
# Static files caching
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ {
expires 30d;
access_log off;
add_header Cache-Control "public, immutable";
}
# Upload directories - prevent PHP execution
location ~* ^/uploads/.*\.php$ {
deny all;
access_log off;
log_not_found off;
}
# Deny access to composer files
location ~* composer\.(json|lock)$ {
deny all;
access_log off;
log_not_found off;
}
}
# HTTPS Configuration (Optional - uncomment after SSL setup)
# server {
# listen 443 ssl http2;
# listen [::]:443 ssl http2;
#
# server_name trevio-dev.mfjrxn.eu.org;
#
# root /var/www/trevio-dev/public;
# index index.php index.html;
#
# # SSL Certificate paths (update with your cert paths)
# ssl_certificate /etc/letsencrypt/live/trevio-dev.mfjrxn.eu.org/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/trevio-dev.mfjrxn.eu.org/privkey.pem;
#
# # SSL Configuration
# ssl_protocols TLSv1.2 TLSv1.3;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
#
# # Include same location blocks as HTTP version above
# # ... (copy all location blocks from above)
# }