Задать вопрос
  • Настройка редиректа на https nginx?

    @shevlyakovn Автор вопроса
    Много конфигов, наследение isp manager. Итоговое решение, которое работает.
    server {
    listen 99.99.999.999:80;
    server_name test.ru www.test.ru;
    charset UTF-8;
    disable_symlinks if_not_owner from=$root_path;
    index index.html index.php;
    root $root_path;
    set $root_path /var/www/test/data/www/test.ru;
    access_log /var/www/httpd-logs/test.access.log ;
    error_log /var/www/httpd-logs/test.error.log notice;
    include /etc/nginx/vhosts-includes/*.conf;
    ssi on;


    location /test/ {
    location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
    try_files $uri $uri/ @fallback;
    expires 3d;
    }
    location /test/ {
    try_files /does_not_exists @fallback;
    }
    location ~ [^/]\.ph(p\d*|tml)$ {
    try_files /does_not_exists @fallback;
    }
    }
    location / {
    return 301 https://$host$request_uri;
    }
    location @fallback {
    proxy_pass http://127.0.0.1:8080;
    proxy_redirect 127.0.0.1:8080 /;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    access_log off ;
    }

    }