This repository has been archived by the owner on Aug 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
/
nginx.conf
63 lines (51 loc) · 1.74 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
server {
listen 80 default_server;
server_name _;
index index.php index.html;
root /frontend/;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
# Hide Nginx Server Version
server_tokens off;
# Size Limits & Buffer Overflows
client_body_buffer_size 100K;
client_header_buffer_size 1k;
client_max_body_size 100k;
large_client_header_buffers 2 1k;
# Allow a larger response buffer
subrequest_output_buffer_size 100k;
# X-Frame-Options is to prevent from clickJacking attack
add_header X-Frame-Options "SAMEORIGIN";
# Disable content-type sniffing on some browsers.
add_header X-Content-Type-Options "nosniff";
# This header enables the Cross-site scripting (XSS) filter
add_header X-XSS-Protection "1; mode=block";
# This will enforce HTTP browsing into HTTPS and avoid ssl stripping attack
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
# Limit HTTP methods
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 405;
}
# Deny access to (dot) hidden files
location ~ /\. {
access_log off;
log_not_found off;
deny all;
}
# Serve static assets
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
access_log off;
log_not_found off;
expires 7d;
}
# Handle PHP reverse proxy
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}