-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathnginx.conf
188 lines (154 loc) · 5 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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# micro-MVC :: Nginx Configuration
# Copyright (C) 2016 - 2024
# Open Software License (OSL 3.0)
user nobody nogroup;
worker_processes 2;
events {
worker_connections 50;
}
http {
include mime.types;
default_type text/html;
charset utf-8;
sendfile on;
keepalive_timeout 90;
gzip on;
gzip_types text/plain
text/xml
text/css
application/xml
application/xhtml+xml
application/json
application/x-javascript
application/javascript
application/vnd.ms-fontobject
application/x-font-ttf
image/svg+xml
font/opentype;
gzip_vary on;
gzip_comp_level 5;
gzip_buffers 4 32k;
gzip_min_length 1000;
gzip_proxied no-cache no-store private expired auth;
gzip_disable "msie6";
index index.php;
server {
include fastcgi_params;
listen 80;
server_name localhost;
# <*SPECIAL LINE*> - ENABLE THIS LINE ONLY WHEN YOY HAVE ACTIVATED HTTPS AND YOU WANT TO REDIRECT HTTP TO HTTPS
# return 301 https://$server_addr;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 32k;
fastcgi_buffers 4 32k;
fastcgi_busy_buffers_size 32k;
fastcgi_temp_file_write_size 32k;
client_body_timeout 10;
client_header_timeout 10;
send_timeout 60;
output_buffers 1 32k;
postpone_output 1460;
error_page 400 = @error;
error_page 404 = @error;
error_page 500 = @error;
error_page 502 = @error;
error_page 504 = @error;
root /;
rewrite ^/(.*)/$ /index.php?req=$1;
rewrite ^([^.]*[^/])$ $1/ permanent;
location @error {
return 301 /;
}
location ~ \.phtml$ {
return 301 /;
}
location ~ \.cfg$ {
return 301 /;
}
location ~ \.log$ {
return 301 /;
}
location ~ \.htaccess$ {
return 301 /;
}
location / {
add_header 'Content-Security-Policy' "script-src 'self' 'unsafe-inline';";
add_header 'X-Frame-Options' 'SAMEORIGIN';
add_header 'X-XSS-Protection' '1; mode=block';
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'POST';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
}
location ~ \.php$ {
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
}
}
# IF YOU ENABLE THE HTTPS PLEASE COMMENT OUT THE ABOVE CONFIGURATION FOR HTTP AND ENABLE ONLY THE <*SPECIAL LINE*>
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate /etc/nginx/ssl/YOURSITE.csr;
# ssl_certificate_key /etc/nginx/ssl/YOURSITE.key;
# ssl_session_timeout 1d;
# ssl_session_cache shared:SSL:1m;
# add_header Strict-Transport-Security max-age=2592000;
# fastcgi_connect_timeout 300;
# fastcgi_send_timeout 300;
# fastcgi_read_timeout 300;
# fastcgi_buffer_size 32k;
# fastcgi_buffers 4 32k;
# fastcgi_busy_buffers_size 32k;
# fastcgi_temp_file_write_size 32k;
# client_body_timeout 10;
# client_header_timeout 10;
# send_timeout 60;
# output_buffers 1 32k;
# postpone_output 1460;
# error_page 400 = @error;
# error_page 404 = @error;
# error_page 500 = @error;
# error_page 502 = @error;
# error_page 504 = @error;
# root /;
# rewrite ^/(.*)/$ /index.php?req=$1;
# rewrite ^([^.]*[^/])$ $1/ permanent;
# location @error {
# return 301 /;
# }
# location ~ \.phtml$ {
# return 301 /;
# }
# location ~ \.cfg$ {
# return 301 /;
# }
# location ~ \.log$ {
# return 301 /;
# }
# location ~ \.htaccess$ {
# return 301 /;
# }
# location / {
# add_header 'Content-Security-Policy' "script-src 'self' 'unsafe-inline';";
# add_header 'X-Frame-Options' 'SAMEORIGIN';
# add_header 'X-XSS-Protection' '1; mode=block';
# add_header 'Access-Control-Allow-Origin' '*';
# add_header 'Access-Control-Allow-Methods' 'POST';
# add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
# add_header 'Access-Control-Expose-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
# }
# location ~ \.php$ {
# fastcgi_index index.php;
# include fastcgi_params;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_pass unix:/var/run/php5-fpm.sock;
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
# }
#}
}