Welcome! Log In Create A New Profile

Advanced

Редирект на HTTPS в зависимости от location

December 11, 2012 02:30PM
Добрый день,

Фрагмент nginx.conf:
-------------------------------------------------------------------
...
ssl_certificate /etc/ssl/site.crt;
ssl_certificate_key /etc/ssl/site.key;

server {

listen 80 default_server;
listen 443 ssl;

...

location ~ \.php$ {
try_files $uri = 404;
include fastcgi_params;
fastcgi_pass localhost:9000;
fastcgi_param HTTPS on;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
}

}
...
-------------------------------------------------------------------

Хочется реализовать автоматический редирект на HTTPS с HTTP в случае, если пользователь переходит в специфический location, например:
http://localhost/sign -> https://localhost/sign/

Возможно ли такое реализовать средствами nginx и как сделать это грамотно?
Subject Author Posted

Редирект на HTTPS в зависимости от location

Antwerpen December 11, 2012 02:30PM

Re: Редирект на HTTPS в зависимости от location

Вадим Лазовский December 12, 2012 12:50AM

Re: Редирект на HTTPS в зависимости от location

Antwerpen December 12, 2012 01:39AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 69
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready