美好的一天。我得到了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连接。
请帮忙。
答案 0 :(得分:0)
将其放入443服务器块
location = / {
return 301 http://my-fin.ru/;
}