3

I am trying to set up nginx as a reverse proxy with HTTP Authentication to a site running on IIS. I have modified the http.sys bindings, as well as my IIS site bindings so that nginx can successfully listen on port 80.

When I access http:// 127.0.0.1 from the server I get the nginx HTTP Authentication dialog as expected, and if I provide credentials it proxies to my IIS application as expected. If I access http:// localhost:8080 I get my IIS application as expected.

However, trying to access the site from another machine fails to connect. I've tried completely disabling the firewall but that doesn't do any good either. Here is my nginx configuration:

worker_processes  1;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;

    server {
        listen       0.0.0.0:80;
        server_name  localhost;

        location / {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass http://localhost:8080/;
            auth_basic           "closed site";
            auth_basic_user_file htpasswd;
        }

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

1 Answer 1

3

Change listen 0.0.0.0:80; to listen *:80;.

REF: http://nginx.org/en/docs/http/ngx_http_core_module.html#listen

3
  • I updated the configuration, but it still cannot be accessed from outside. I changed it to *:81 and I can get there, but not *:80.
    – Matt Baker
    Nov 17, 2014 at 18:22
  • However, I removed localhost from the server_name field, put the external hostname, and now it works.
    – Matt Baker
    Nov 17, 2014 at 18:23
  • @MattBaker, what do you mean, did you change localhost to 127.0.0.1 That's how I got nginx to server files
    – pixel 67
    Oct 13, 2015 at 12:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .