1

再会。我得到了网络应用程序和 NGINX 作为代理。所以我需要我的主页与http一起使用。以及所有其他带有 https 的页面。

这是我的 NGINX 配置:

server {
       listen           80;
       server_name              my-fin.ru www.my-fin.ru;

        root         /usr/server/finance/abacus/webapp;

        location ~ ^/.+\.(eot|ttf|woff)$ {
            expires 1d;
            add_header Cache-Control public;
            add_header Access-Control-Allow-Origin *;
        }

        location ~ ^/.+\.(ico|jpg|jpeg|gif|pdf|jar|png|js|css|epf|svg)$ {
            expires 1d;
            add_header Cache-Control public;
        }
     location / {
                # give site more time to respond
                proxy_read_timeout 120;
                proxy_pass        http://127.0.0.1:8087;
                proxy_redirect          http:// $scheme://;

                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr ;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
        }


}

server {
        listen          *:443;
        server_name     my-fin.ru;
        client_max_body_size 10m;
        gzip                    on;
        gzip_min_length 500;
        gzip_buffers    4 8k;
        gzip_types              text/plain text/xml application/xml application/x-javascript text/javascript text/css text/json application/json;

        access_log  /var/log/nginx/finance.access.log;
        error_log   /var/log/nginx/finance.error.log;

        ssl on;
        ssl_certificate         /usr/server/myfin.crt;
        ssl_certificate_key     /usr/server/myfin.key;
        charset                 utf-8;

        root         /usr/server/finance/abacus/webapp;

     rewrite https://my-fin.ru http://my-fin.ru;       
    location /logout {
        return 301 http://my-fin.ru;
    }
        location ~ ^/.+\.(eot|ttf|woff)$ {
            expires 1d;
            add_header Cache-Control public;
            add_header Access-Control-Allow-Origin *;
        }

        location ~ ^/.+\.(ico|jpg|jpeg|gif|pdf|jar|png|js|css|epf|svg)$ {
            expires 1d;
            add_header Cache-Control public;
        }
        location /features {
                return 301 http://my-fin.ru/features;
            }
             location /price {
                return 301 http://my-fin.ru/price;
            }
             location /help {
                return 301 http://my-fin.ru/help;
            }
             location /about {
                return 301 http://my-fin.ru/about;
            }

        location / {
                # give site more time to respond
                proxy_read_timeout 120;
                proxy_pass        http://127.0.0.1:8087/;
                proxy_redirect          http:// $scheme://;

                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr ;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
        }

}

所以,我需要将用户从https://domain.ru重定向到http://domain.ru。对于所有其他页面,例如https://domain.ru/help - 可以保持 https 连接。

请帮忙。

4

1 回答 1

0

把它放在 443 服务器块中

    location = / {
        return 301 http://my-fin.ru/;
    }
于 2013-10-07T09:18:06.487 回答