1

良い一日。プロキシとして Web アプリケーションと 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