-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathnginx.conf
57 lines (47 loc) · 1.33 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
server {
listen 80;
server_name localhost;
index index.php index.html index.htm;
root /var/www/html;
# HTTP_TO_HTTPS_END
location / {
if (!-e $request_filename) {
rewrite ^/(.[a-zA-Z0-9\-\_]+).html$ /index.php?mod=$1 last;
}
rewrite ^/pay/(.*)$ /pay.php?s=$1 last;
}
location ^~ /plugins {
deny all;
}
location ^~ /includes {
deny all;
}
location ~ \.php$ {
include /etc/nginx/snippets/fastcgi-php.conf;
}
# 禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.env|\.svn|\.project|LICENSE|README.md) {
return 404;
}
# 一键申请SSL证书验证目录相关设置
location ~ \.well-known {
allow all;
}
# 禁止在证书验证目录放入敏感文件
if ($uri ~ "^/\.well-known/.*\.(php|jsp|py|js|css|lua|ts|go|zip|tar\.gz|rar|7z|sql|bak)$") {
return 403;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
error_log /dev/null;
access_log /dev/null;
}
location ~ .*\.(js|css)?$ {
expires 12h;
error_log /dev/null;
access_log /dev/null;
}
access_log /www/wwwlogs/localhost.log;
error_log /www/wwwlogs/localhost.error.log;
error_page 497 https://$host$request_uri;
}