Score:0

Configuring nginx to work with wildfly with proxypass

cn flag

I want to configure my nginx config in such a way that non https upgrades to https and then the proxy pass should go to https://ip:8443/SOMECONTEXT/

How can I achieve it

This is the config I am using

server {
    listen  ip:80;
    server_name  subdomain1.example.com subdomain2.example.com;

    access_log  /var/log/nginx/subdomain1.example.com_access.log;
    error_log /var/log/nginx/subdomain1.example.com_error.log warn;
    
    location /.well-known/acme-challenge {
        default_type "text/plain";
        root /var/www/html;
    }

    location / {
        return 301 https://$host/$request_uri;
    }
}

server {
    listen  ip:443;
    server_name subdomain1.example.com subdomain2.example.com;

    access_log  /var/log/nginx/subdomain1.example.com_access.log;
    error_log /var/log/nginx/subdomain1.example.com_error.log warn;

    location / {
        proxy_set_header  Host $host;
        proxy_set_header  X-Real-IP $remote_addr;
        proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header  X-Forwarded-Proto $scheme;
        proxy_pass https://ip:8443/;
        proxy_connect_timeout       6000;
        proxy_send_timeout          6000;
        proxy_read_timeout          6000;
        send_timeout                6000;
    }
}
djdomi avatar
za flag
is there a reason why you bind not to all interfaces?
mudit avatar
cn flag
@djdomi I didn't understand what you mean by bind to interfaces. I have many domains that will forward to other ports in proxy
djdomi avatar
za flag
you use listen ip:443; <- your are missing listen ip:443 ssl; however you could just use listen 443 ssl; in case you want to use ssl
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.