server {
server_name www.site.com site.com;
listen 80;
port_in_redirect off;
root /var/www/site/public; <----ВНИМАНИЕ НА ЭТУ СТРОКУ, PUBLIC ОБЯЗАТЕЛЕН
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
# Cache static files for as long as possible
location ~*.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|cur)$ {
expires max;
log_not_found off;
access_log off;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
server {
listen 80;
server_name ИМЯ_СЕРВЕРА;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name ИМЯ_СЕРВЕРА;
ssl_certificate /etc/letsencrypt/live/ИМЯ_СЕРВЕРА/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/keys/0008_key-certbot.pem;
ssl_protocols TLSv1 TLSv1.1 TLSV1.2;
access_log /var/log/nginx/ИМЯ_СЕРВЕРА_proxy.log;
location / {
proxy_pass http://192.168.169.4;
}
}