Помогите разобраться с конфигом. Получил сертификат на lets encrypt сертботом, меняю конфиг на стардартный под ngnix+php7 и вместо форума получаю "сайт выполнил слишком много редиректов" оба конфига ниже.
Оба конфига проходят валидацию (ngnix не ругается при рестарте), но при втором не удается войти на форум и вообще ничего кроме "слишком много переадресаций", пытался лечить через .htaccess - не вышло.
Что я делаю не так?
server {
server_name myals.ru www.myals.ru;
listen 80;
root /home/web/public/myals.ru;
index index.php;
server_tokens off;
charset utf-8;
client_max_body_size 128M;
error_log /home/web/log/myals.ru.nginx.log crit;
access_log off;
log_not_found off;
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;
location ~ /\. {
deny all;
}
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off;
log_not_found off;
expires 1d;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri $uri/ =404;
fastcgi_pass unix:/var/run/php-fpm/www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
server_name myals.ru www.myals.ru;
listen 80;
root /home/web/public/myals.ru;
index index.php;
server_tokens off;
charset utf-8;
client_max_body_size 128M;
error_log /home/web/log/myals.ru.nginx.log crit;
access_log off;
log_not_found off;
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;
location ~ /\. {
deny all;
}
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off;
log_not_found off;
expires 1d;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri $uri/ =404;
fastcgi_pass unix:/var/run/php-fpm/www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
server {
listen 80;
server_name myals.ru www.myals.ru;
return 301 https://$server_name$request_uri;
}
server {
server_name myals.ru www.myals.ru;
listen 443 ssl;
root /home/web/public/myals.ru;
index index.php;
server_tokens off;
charset utf-8;
client_max_body_size 128M;
ssl on;
ssl_certificate /home/web/ssl/ssl.myals.ru.pem;
ssl_certificate_key /home/web/ssl/ssl.myals.ru.key;
ssl_session_cache shared:SSL:100m;
ssl_session_timeout 60m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'EECDH+ECDSA+AESGCM:AES128+EECDH:AES128+EDH:!RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!CAMELLIA:!ADH';
ssl_prefer_server_ciphers on;
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;
error_log /home/web/log/myals.ru.nginx.log;
access_log off;
log_not_found off;
location ^~ /.well-known/ {
allow all;
try_files $uri $uri/ =404;
}
location ~ /\. {
deny all;
}
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off;
log_not_found off;
expires 1d;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri $uri/ =404;
fastcgi_pass unix:/var/run/php-fpm/www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
listen 80;
server_name myals.ru www.myals.ru;
return 301 https://$server_name$request_uri;
}
server {
server_name myals.ru www.myals.ru;
listen 443 ssl;
root /home/web/public/myals.ru;
index index.php;
server_tokens off;
charset utf-8;
client_max_body_size 128M;
ssl on;
ssl_certificate /home/web/ssl/ssl.myals.ru.pem;
ssl_certificate_key /home/web/ssl/ssl.myals.ru.key;
ssl_session_cache shared:SSL:100m;
ssl_session_timeout 60m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'EECDH+ECDSA+AESGCM:AES128+EECDH:AES128+EDH:!RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!CAMELLIA:!ADH';
ssl_prefer_server_ciphers on;
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;
error_log /home/web/log/myals.ru.nginx.log;
access_log off;
log_not_found off;
location ^~ /.well-known/ {
allow all;
try_files $uri $uri/ =404;
}
location ~ /\. {
deny all;
}
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off;
log_not_found off;
expires 1d;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri $uri/ =404;
fastcgi_pass unix:/var/run/php-fpm/www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Оба конфига проходят валидацию (ngnix не ругается при рестарте), но при втором не удается войти на форум и вообще ничего кроме "слишком много переадресаций", пытался лечить через .htaccess - не вышло.
Что я делаю не так?