Welcome! Log In Create A New Profile

Advanced

Re: Передресация с http на https://

December 30, 2014 10:28AM
Отчего же, ответил именно на поставленный вопрос. Да, правда вижу опечатку
в примере, там вот так должно быть:

server {
listen 192.168.7.1:80 http://192.168.7.1/ default_server;
listen 192.168.7.2:443 ssl default_server;
server_name example.com;

# HTTP -> HTTPS
location /manager {
if ($scheme = http) { rewrite ^(.*) https://$server_name$1
permanent; }
<...>
}

# HTTPS -> HTTP
location / {
if ($scheme = https) { rewrite ^(.*) http://$server_name$1
permanent; }
<...>
}

On Tue, Dec 30, 2014 at 6:14 PM, hitarcher <nginx-forum@nginx.us> wrote:

> вот конфиг, прописал редирект c http://domain.me/manager на
> https://domain.me/manager вроде работает, а теперь как прописать редирект
> все остальное с https на http, помогите пожалуйста!
>
> server {
> server_name domain.me www.domain.me;
> charset UTF-8;
> disable_symlinks if_not_owner from=$root_path;
> index index.html index.php;
> root $root_path;
> set $root_path /home/domain.me;
> ssi on;
> access_log /home/httpd-logs/domain.me.access.log ;
> error_log /home/httpd-logs/domain.me.error.log notice;
> include /etc/nginx/vhosts-includes/*.conf;
>
> location ^~ /manager {
> if ($scheme = http) {
> return 301 https://$host$request_uri;
> }
> try_files $uri $uri/ @backend;
> }
>
> 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 {
> error_log /dev/null crit;
> 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;
> proxy_set_header X-Forwarded-Secret GeBJ20wa6DzIiPCK;
> access_log off ;
> }
> listen 123.123.123.123:80;
> }
>
> server {
> server_name domain.me www.domain.me;
> charset UTF-8;
> disable_symlinks if_not_owner from=$root_path;
> index index.html index.php;
> root $root_path;
> set $root_path /home/ziranov/data/www/domain.me;
> ssi on;
> access_log /home/httpd-logs/domain.me.access.log ;
> error_log /home/httpd-logs/domain.me.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 {
> error_log /dev/null crit;
> 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;
> proxy_set_header X-Forwarded-Secret GeBJ20wa6DzIiPCK;
> access_log off ;
> }
> listen 123.123.123.123:443;
> ssl on;
> ssl_certificate /var/www/httpd-cert/ziranov/domain.me.crt;
> ssl_certificate_key /var/www/httpd-cert/ziranov/domain.me.key;
> }
>
> Posted at Nginx Forum:
> http://forum.nginx.org/read.php?21,255869,255883#msg-255883
>
> _______________________________________________
> nginx-ru mailing list
> nginx-ru@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-ru
>



--
Best regards, Juriy Strashnov

Mob. +7 (953) 742-1550
E-mail: j.strashnov@me.com

Please consider the environment before printing this email.
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

Передресация с http на https://

hitarcher December 30, 2014 03:52AM

Re: Передресация с http на https://

foboss December 30, 2014 08:24AM

Re: Передресация с http на https://

hitarcher December 30, 2014 10:09AM

Re: Передресация с http на https://

hitarcher December 30, 2014 10:14AM

Re: Передресация с http на https://

foboss December 30, 2014 10:28AM

Re: Передресация с http на https://

hitarcher December 30, 2014 10:41AM

Re: Передресация с http на https://

mva December 30, 2014 11:50AM

Re: Передресация с http на https://

hitarcher December 30, 2014 11:51AM

Re: Передресация с http на https://

hitarcher December 30, 2014 11:52AM

Re: Передресация с http на https://

Daniel Podolsky December 30, 2014 12:58PM

Re: Передресация с http на https://

hitarcher December 30, 2014 01:15PM

Re: Передресация с http на https://

Daniel Podolsky December 30, 2014 01:42PM

Re: Передресация с http на https://

hitarcher December 30, 2014 01:51PM

Re: Передресация с http на https://

Daniel Podolsky December 30, 2014 02:12PM

Re: Передресация с http на https://

hitarcher December 30, 2014 02:24PM

Re: Передресация с http на https://

Andrey Kopeyko December 30, 2014 02:14PM

Re: Передресация с http на https://

hitarcher December 30, 2014 02:25PM

Re: Передресация с http на https://

hitarcher December 30, 2014 02:26PM

Re: Передресация с http на https://

mva December 30, 2014 02:30PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 298
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready