Типичный конфиг NGINX
Базовый конфиг ngnx сервера
server {
listen 80;
server_name domain.com www.domain.com;
root /var/www/domain.com/web;
index index.php;
autoindex off;
# Let's encrypt
location ~ /.well-known {
root /var/www/html;
allow all;
break;
}
# Deny folders
location ~ /\.cgi.* { deny all; }
location ~ /\.svn.* { deny all; }
location ~ /\.hg.* { deny all; }
location ~ /\.ht.* { deny all; }
location ~ /\.git.* { deny all; }
location ~ /composer.* { deny all; }
location ~ /node_modules.* { deny all; }
location ~ /vendor.* { deny all; }
location ~ \.sql$ { deny all; }
# Search Engine Friendly URLs
location / {
if (-f $request_filename) {
break;
}
rewrite ^/. /index.php last;
}
# PHP FPM for index.php
location /index.php {
fastcgi_pass 127.0.0.1:9071;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
break;
}
# Enable cache
location ~* ^.+\.(css|js|jpg|jpeg|png|bmp|ico|svg)$ {
expires max;
}
}