11server {
22 listen portnumber;
33 server_name domain www.domain;
4-
4+
55 access_log /log/nginx/filename.com.uwsgi_access.log main;
66 error_log /log/nginx/filename.com.uwsgi_error.log warn;
7-
7+
8+ # if ($host !~* ^(domain\.com|www\.domain\.com)$) {
9+ # return 444;
10+ # }
11+
812 # Django media
913 location /media {
1014 gzip_static on;
@@ -18,61 +22,61 @@ server {
1822 gzip_static on;
1923 expires max;
2024 #alias /www/django_sample/static;
21- # normally static folder is named as /static
25+ # normally static folder is named as /static
2226 alias /www/webroot/static; # your Django project's static files - amend as required
2327 #include /etc/nginx/mime.types;
2428 }
2529
2630 location / {
2731 uwsgi_pass appname:serviceport;
2832
29- uwsgi_max_temp_file_size 20480m;
30- uwsgi_buffering off;
31- uwsgi_ignore_client_abort on;
32- uwsgi_buffers 2560 160k;
33- uwsgi_buffer_size 2560k;
34- uwsgi_connect_timeout 30s;
35- uwsgi_send_timeout 30s;
36- uwsgi_read_timeout 30s;
37- uwsgi_busy_buffers_size 2560k;
38- uwsgi_temp_file_write_size 2560k;
39- proxy_read_timeout 30s;
40- proxy_connect_timeout 75s;
33+ uwsgi_max_temp_file_size 20480m;
34+ uwsgi_buffering off;
35+ uwsgi_ignore_client_abort on;
36+ uwsgi_buffers 2560 160k;
37+ uwsgi_buffer_size 2560k;
38+ uwsgi_connect_timeout 30s;
39+ uwsgi_send_timeout 30s;
40+ uwsgi_read_timeout 30s;
41+ uwsgi_busy_buffers_size 2560k;
42+ uwsgi_temp_file_write_size 2560k;
43+ proxy_read_timeout 30s;
44+ proxy_connect_timeout 75s;
4145
4246 # proxy_redirect http:// https://;
4347
4448 }
45-
49+
4650 # Allow Lets Encrypt Domain Validation Program
4751 location ^~ /.well-known/acme-challenge/ {
4852 allow all;
4953 root /www/webroot;
5054 }
51-
55+
5256 # Block dot file (.htaccess .htpasswd .svn .git .env and so on.)
5357 location ~ /\. {
5458 deny all;
5559 }
56-
60+
5761 # Block (log file, binary, certificate, shell script, sql dump file) access.
5862 location ~* \.(log|binary|pem|enc|crt|conf|cnf|sql|sh|key|yml|lock)$ {
5963 deny all;
6064 }
61-
65+
6266 # Block access
6367 location ~* (composer\.json|composer\.lock|composer\.phar|contributing\.md|license\.txt|readme\.rst|readme\.md|readme\.txt|copyright|artisan|gulpfile\.js|package\.json|phpunit\.xml|access_log|error_log|gruntfile\.js)$ {
6468 deny all;
6569 }
66-
70+
6771 location = /favicon.ico {
6872 log_not_found off;
6973 access_log off;
7074 }
71-
75+
7276 location = /robots.txt {
7377 log_not_found off;
7478 access_log off;
75- }
79+ }
7680
7781 if ($bad_bot) {
7882 return 403;
0 commit comments