我使用以下配置将 nginx 配置为反向代理:
www.mydomain.com --> drupal.mydomain.com
www.mydomain.com/store --> magento.navionics.com
Drupal(网站)
location / {
proxy_pass http://10.21.120.12/;
proxy_redirect http://10.21.120.12/ http://$server_name/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 50m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
Magento
location /store {
proxy_pass http://10.192.134.10/;
proxy_redirect http://10.192.134.10/ http://$server_name/store/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 50m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
当我尝试 www.mydomain.com 时,我可以看到 drupal 网站。
当我尝试 www.mydomain.com/store 或 www.mydomain.com/store/ 我收到错误
"Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects."