Score:0

How to forward all requests from one port to another with nginx

es flag

I want to be able to visit https://localhost:888/ in my browser and have it behave identically as if I had accessed https://localhost:999/

How can I do that?

I tried adding

server {
    listen   888;
    server_name  localhost;
    location / {
        proxy_pass https://localhost:999;
        include /etc/nginx/proxy_params;
    }
}

to a new file /usr/local/etc/nginx/servers/default, but I can't access any webpage at localhost:888 (even though localhost:999 responds fine)

I am using homebrew (brew install nginx) version of nginx

us flag
What does "can't access" mean? What is the exact error message?
theonlygusti avatar
es flag
@TeroKilkanen same error as visiting http://hallalaopsupaus.com, cannot find the server
us flag
The domain doesn't have proper DNS records.
theonlygusti avatar
es flag
@tero "localhost" doesnt have proper dns records??
us flag
If you get the same error `DNS_PROBE_FINISHED_NXDOMAIN`, it means that the domain you are accessing does not have proper DNS records.
theonlygusti avatar
es flag
@TeroKilkanen it just says "Safari cannot find the server"
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.