Hi ppl I am trying to setup nginx 1.0.12 as a proxy for apache 2.2.15, but faced strange problem. And I cannot solve it for third day in a row I have test site http://c-craft.info and have installed roundcube in /roundcube subdirectory. So here is the problem: If you will try to open http://c-craft.info/roundcube you will get strange redirect back to your own IP address. So nginx tries to download static files from remote_addr. But if you will add trailing slash to uri http://c-craft.info/roundcube/ it will work. Another example: try to open http://www.contra.lv - you also will get redirect back to your own IP address and again nginx tries to download static files from remote_addr. Interesting thing is that connencting through apache works nice: http://c-craft.info:9091/roundcube http://contra.lv:9091 I really need your advice how to fix it, cause I am stuck Here is my config files: nginx.conf sites-enabled/default sites-enabled/c-craft.info.conf sites-enabled/contra.lv.conf proxy.conf In apache httpd.conf I have: Thank you in advance for any advice you have
is this now working? i reviewed the post and hello from c-craft.info does not redirect. Pls reply with an update as this is great way for newbie to learn ... thx in advance
Yeah, this one does not redirect. But http://c-craft.info/roundcube and http://www.contra.lv does... And this driving me crazy.
c-craft.info/roundcube is working for me as well, while contra.lv isn't. The only difference in your vhosts that I see is server_name_in_redirect off;
c-craft.info/roundcube - you do not have any redirects? Sure that it opens normally without trailing slash? I put server_name_in_redirect off; to contra.lv.conf, but it did not help... Update: Ok, I think I found the problem. For some reason $_SERVER["HTTP_HOST"] is incorrect - it is getting equal to $remote_addr, but not always... this is weird. I am trying to understand how does this happen, is it nginx, apache or PHP problem? Update 2: So this sounds like nginx problem... you can check two test addresses: http://contra.lv/server.php and http://contra.lv:9091/server.php. You can see, that HTTP_POST is different on nginx and apache...
I solved one of the problems. On another forum user adviced me to change $host to $http_host in the proxy.conf and add there new line: $_SERVER["HTTP_HOST"] is correct now and contra.lv is working In fact after adding this line everything it started to work. But in all tutorials about nginx as reverse_proxy there is nothing about this line... And the problem with trailing slash still exists: http://c-craft.info/roundcube still redirects back to $remote_addr.