我想使用nginx为https站点创建http代理
但是我有两个问题:
1- HTTP重定向到HTTP的循环。
2-我要删除www
表单url,但不起作用
我的nginx配置:
server {
listen 80;
server_name www.ez.localhost;
return 301 http://ez.localhost$request_uri;
}
server {
listen 443 ssl;
server_name www.ez.localhost, ez.localhost;
return 301 http://ez.localhost$request_uri;
ssl_certificate /localhost.crt;
ssl_certificate_key /localhost.key;
}
server {
listen 80;
server_name ez.localhost;
# disable cache
add_header Cache-Control "no-cache, must-revalidate, max-age=0";
location / {
proxy_pass https://www.eghamat24.com/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect $scheme:// http://;
proxy_buffering off;
}
}