Score:0

Nginx reverse proxy to IIS backend not working

cn flag

New to nginx. I have a VM running Nginx 1.20.1 as a reverse proxy with IP 10.0.0.4. I also have a VM with IIS serving app A with IP 10.0.0.19. The subdomain xyz.test.com.my is pointing to Nginx. From the Nginx VM, I can access app A on IIS using http://10.0.0.19/ABC/Frames/Login.aspx. Even if I use http://10.0.0.19/ABC it also works.

The problem is, i cannot access app A from xyz.test.com.my. I have tried making changes to proxy_pass as follows:

Situation 1:

proxy_pass http://10.0.0.19/ABC/Frames/Login.aspx;

Pages will load but not completely. The logo and background image will not appear.

Situation 2:

proxy_pass http://10.0.0.19;

Only display IIS default page. But if i type this URL in the browser (http://xyz.test.com.my/ABC/Frames/Login.aspx), the page opens successfully.

Situation 3:

proxy_pass http://10.0.0.19/;

Same as situation 2.

Situation 4:

proxy_pass http://10.0.0.19/ABC;

Sorry, page not found.

.

So far I've only tried port 80. If it works, then I'll do port 443. My final idea is to let Nginx work as the SSL layer and talks to other VMs via HTTP or whatever protocols unencrypted. Then of course when Nginx talks back to the client, the messages will be encrypted.

Here is the nginx.conf:

# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 4096;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

}

And here is the xyz.test.com.my.conf:

server {
    listen 80;
    listen [::]:80;
    server_name xyz.test.com.my www.xyz.test.com.my;

    location / {
        proxy_pass http://10.0.0.19;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
}

Many thanks in advance!

Lex Li avatar
vn flag
Did you try `proxy_pass http://10.0.0.19/ABC/;`?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.