Skip to content

Instantly share code, notes, and snippets.

@znechai
Last active April 6, 2017 15:53
Show Gist options
  • Save znechai/b8f5ab738680b92f08b3e02f2322fbe6 to your computer and use it in GitHub Desktop.
Save znechai/b8f5ab738680b92f08b3e02f2322fbe6 to your computer and use it in GitHub Desktop.
Nginx - nginx virtual server+
server {
listen 80;
root /var/www/HOST/;
index index.php index.html;
server_name HOST.com www.HOST.com;
return 301 $scheme://HOST.by$request_uri;
autoindex off;
charset utf-8;
server_tokens off;
sendfile on;
access_log off;
error_log /var/log/nginx/$host;
gzip on;
gzip_disable "msie6";
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
if ( $http_user_agent ~* (nmap|nikto|wikto|sf|sqlmap|bsqlbf|w3af|acunetix|havij|appscan) ) {
return 403;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
add_header Cache-Control "public";
expires +1y;
}
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment