-
-
Notifications
You must be signed in to change notification settings - Fork 438
Expand file tree
/
Copy pathnginx.conf
More file actions
73 lines (58 loc) · 2.15 KB
/
Copy pathnginx.conf
File metadata and controls
73 lines (58 loc) · 2.15 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
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
# Database backups (with logos) can be tens of MB. The nginx default of 1M
# would reject a restore upload with 413 before PHP ever sees it.
client_max_body_size 256M;
server {
listen [::]:80 ipv6only=off;
server_name localhost;
location / {
root /var/www/html;
index index.php;
}
# Deny rules must precede the generic \.php$ handler below. nginx evaluates
# regex locations in order and uses the first match, so these have to come
# first — otherwise \.php$ matches and executes PHP under .tmp/, logos/, etc.
location ~ \.db$ {
deny all;
return 403;
}
location ~* images/uploads/logos/.*\.php$ {
deny all;
return 403;
}
# Block all direct access to the temp working directory. Nothing there is
# ever meant to be served (backups, restore staging, etc.). The prefix
# match outranks the \.php$ regex below, so extracted PHP is unreachable.
location ^~ /.tmp/ {
deny all;
return 403;
}
location ~* ^/includes/.*\.php$ {
deny all;
return 403;
}
location ~ \.php$ {
root /var/www/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
include /etc/nginx/conf.d/*.conf;
}