Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm using nginx as a reverse proxy for website running on IIS 7.5. Website is bound to Nginx configuration looks like this:

server {
    listen 80;


    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Accel-Expires 0;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

What I want to do is forward requests which come to (linux machine with nginx) to (windows machine with IIS and my website). However what happens is

  • when I access, I get 404 page
  • when I access directly I get my website served normally from IIS
  • nginx seems to forward requests normally to windows machine
  • I can't see any incoming requests from IIS logs when I access
  • when I add binding for on IIS, website gets proxied normally with nginx

I would appreciate any ideas on what might be wrong with my setup. Thanks!

share|improve this question
Your configuration looks fine. But I have just few dumb questions: 1. Is pointing to nginx ip? 2. Did you restart nginx after doing modifications? – Hex Oct 20 '12 at 11:56
@Hex: 1. Yes, is pointing to nginx and seems to be served correctly by it. 2. Yes. ; It seems to me that what is forwarded to IIS is still and not I'm not sure if I need to rewrite some headers or something in order to achieve that. – yojimbo87 Oct 20 '12 at 12:02
Can you add access_log and error_log directive in your server block and see what is going on through logs? your headers are fine. – Hex Oct 20 '12 at 12:05
@Hex: There are no errors in error.log file and access.log contains these ( entries when accessing – yojimbo87 Oct 20 '12 at 12:17
Can you please check if your request is going to your IIS by doing: ngrep -q "^GET" – Hex Oct 20 '12 at 12:20

2 Answers 2

up vote 2 down vote accepted

Try to manually add proxy_set_header Host ""

share|improve this answer
I knew I had to do something with headers :). Thanks! – yojimbo87 Oct 20 '12 at 13:09
All I wanted was to know that requests are arriving to your iis, then I noticed the host issue :) Glad you fixed it. – Hex Oct 20 '12 at 13:22
  • when I add binding for on IIS, website gets proxied normally with nginx

IIS has to be aware that it should answer requests for the name Otherwise it routes requests to the Default Website. You can fix this by either creating the binding, or by creating/editing your Website to answer for

share|improve this answer
I'm aware of that, but what I want to achieve is to be processed by nginx which forwards requests to processed by IIS. – yojimbo87 Oct 20 '12 at 12:33
OK, so you have your answer. Did you have another question? – Michael Hampton Oct 20 '12 at 12:34
Adding IIS binding to handle is currently a workaround not solution. I want the website on IIS to be bound only to – yojimbo87 Oct 20 '12 at 12:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.