2

Есть VPS, на нем домен и SSL сертификат через ISP менеджер. Сайт открывается через https, при вводе http идет переадресация на https. Как сделать одну страницу сайта на http (http://supersite.ru/page1), остальные на https?

NGNIX:

#user 'supersite' virtual host 'supersite.ru' configuration file
server {
    server_name supersite.ru www.supersite.ru;
    charset UTF-8;
    disable_symlinks if_not_owner from=$root_path;
    index index.php;
    root $root_path;
    set $root_path /var/www/supersite/data/www/supersite.ru;
    access_log /var/www/httpd-logs/supersite.ru.access.log ;
    error_log /var/www/httpd-logs/supersite.ru.error.log notice;
    include /etc/nginx/vhosts-includes/*.conf;
    location / {
        location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
            try_files $uri $uri/ @fallback;
        }
        location / {
            try_files /does_not_exists @fallback;
        }
        location ~ [^/]\.ph(p\d*|tml)$ {
            try_files /does_not_exists @fallback;
        }
    }
    location @fallback {
        proxy_pass http://127.0.0.1:8080;
        proxy_redirect http://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 ;
    }
    ssi on;
    listen 178.208.75.143:80;
    listen 178.208.81.14:80;
}
server {
    server_name supersite.ru www.supersite.ru;
    charset UTF-8;
    disable_symlinks if_not_owner from=$root_path;
    index index.php;
    root $root_path;
    set $root_path /var/www/supersite/data/www/supersite.ru;
    access_log /var/www/httpd-logs/supersite.ru.access.log ;
    error_log /var/www/httpd-logs/supersite.ru.error.log notice;
    include /etc/nginx/vhosts-includes/*.conf;
    location / {
        location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
            try_files $uri $uri/ @fallback;
        }
        location / {
            try_files /does_not_exists @fallback;
        }
        location ~ [^/]\.ph(p\d*|tml)$ {
            try_files /does_not_exists @fallback;
        }
    }
    location @fallback {
        proxy_pass http://127.0.0.1:8080;
        proxy_redirect http://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 ;
    }
    ssi on;
    add_header Strict-Transport-Security "max-age=31536000;";
    listen 178.208.75.143:443;
    listen 178.208.81.14:443;
    ssl on;
    ssl_certificate "/var/www/httpd-cert/supersite/supersite.crtca";
    ssl_certificate_key "/var/www/httpd-cert/supersite/supersite.key";
    ssl_ciphers HIGH:!RC4:!aNULL:!eNULL:!MD5:!EXPORT:!EXP:!LOW:!SEED:!CAMELLIA:!IDEA:!PSK:!SRP:!SSLv2;
    ssl_prefer_server_ciphers on;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
}
9
  • Если доя браузера, то никак. У вас стоит заголовок STS
    – Alexey Ten
    25 окт 2016 в 19:22
  • С другой стороны я не вижу никакого редиректа на https
    – Alexey Ten
    25 окт 2016 в 19:24
  • А как сделать, чтобы сайт весь открывался и с http и c https?
    – lecherg
    25 окт 2016 в 19:24
  • Вот и я не вижу, а он есть
    – lecherg
    25 окт 2016 в 19:24
  • Как вы проверяли? Что говорит curl -I http://supersite.ru
    – Alexey Ten
    25 окт 2016 в 19:26

1 ответ 1

1

Разделить обработку на 2 сервера, сделав перенаправление ненужных адресов с https на http и не использовать Strict-Transport-Security, чтобы браузер принудительно не перенаправлял все запросы на https-сервер. Здесь пример.

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.