nginx won't listen on non-standard port The Next CEO of Stack OverflowNginx redirecting domain to port 8000 with a 301403 Forbidden nginx (nginx/1.8.0)nginx sending 499 response to uptimerobot?CodeIgniter nginx rewrite rules for i8ln URL'sNginx still redirects even though I removed the rule from the confBest practice to handle default_server and public ip in nginxConfigure NGINX : How to handle 500 Error on upstream itself, While Nginx handle other 5xx errorsWhy Nginx calls for invalid certificate in non-existent subdomains just to redirect to 404?nginx won't redirect http to httpsNginx reverse proxy to many local servers + webserver duty

Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?

Is HostGator storing my password in plaintext?

Anatomically Correct Strange Women In Ponds Distributing Swords

How to count occurrences of text in a file?

How can I open an app using Terminal?

Need some help with wall behind rangetop

Grabbing quick drinks

What do "high sea" and "carry" mean in this sentence?

Example of a Mathematician/Physicist whose Other Publications during their PhD eclipsed their PhD Thesis

Why were Madagascar and New Zealand discovered so late?

When airplanes disconnect from a tanker during air to air refueling, why do they bank so sharply to the right?

Why didn't Khan get resurrected in the Genesis Explosion?

How do I solve this limit?

How long to clear the 'suck zone' of a turbofan after start is initiated?

Can the Reverse Gravity spell affect the Meteor Swarm spell?

Inappropriate reference requests from Journal reviewers

How to write the block matrix in LaTex?

Failed to fetch jessie backports repository

I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin

Was a professor correct to chastise me for writing "Prof. X" rather than "Professor X"?

Visit to the USA with ESTA approved before trip to Iran

Natural language into sentence logic

Shade part of a Venn diagram

How should I support this large drywall patch?



nginx won't listen on non-standard port



The Next CEO of Stack OverflowNginx redirecting domain to port 8000 with a 301403 Forbidden nginx (nginx/1.8.0)nginx sending 499 response to uptimerobot?CodeIgniter nginx rewrite rules for i8ln URL'sNginx still redirects even though I removed the rule from the confBest practice to handle default_server and public ip in nginxConfigure NGINX : How to handle 500 Error on upstream itself, While Nginx handle other 5xx errorsWhy Nginx calls for invalid certificate in non-existent subdomains just to redirect to 404?nginx won't redirect http to httpsNginx reverse proxy to many local servers + webserver duty










0















My organization has a server that is just for handling redirects of retired sites (redirects-myorg.org). We've just retired a website (widgets.org), and I am adding the retired site to our redirects server. About a week ago, we had the CNAME record for widgets.org changed so that it points to redirects-myorg.org.



Most of the URLs that were in circulation for widgets.org looked something like: widgets.org:8180/more/info. The 8180 port was explicitly included in the URL.



Success looks like:



  • Typing widgets.org into a browser: redirects to blue-server.com.

  • Typing widgets.org:8180 into a browser: redirects to purple-server.com

(For additional context: Three other sites' redirects are managed on this redirects server, and their configuration files reference ports 80 and 443. None of those sites use non-standard ports like 8180.)



Attempts



1.
I first set up the nginx configuration files to list to ports 80 and 8180 and return a 301 redirect on each:



server 
listen 8180;
listen [::]:8180;
server_name widgets.org;
return 301 https://purple-server.com;

server
listen 80;
listen [::]:80;
server_name widgets.org;
return 301 https://blue-server.com;



Result:



  • Typing widgets.org into a browser: redirects to blue-server.com. Good.

  • Typing widgets.org:8180 into a browser: hangs and eventually times not. Not so good.

2.
Tried switching the order, unsuccessfully:



server 
listen 80;
listen [::]:80;
server_name widgets.org;
return 301 https://blue-server.com;

server
listen 8180;
listen [::]:8180;
server_name widgets.org;
return 301 https://purple-server.com;



Result:



  • Same as above.

3.
Tried tricking nginx, unsuccessfully:



server 
listen 80;
listen [::]:80;
server_name widgets.org:8180;
return 301 https://purple-server.com;



Result:



  • Typing widgets.org into a browser: "Welcome to nginx!" page. Not so good.

  • Typing widgets.org:8180 into a browser: hangs and eventually times not. Not so good.

4.
Tried tricking nginx a different way, unsuccessfully:



server 
listen 80;
listen [::]:80;
server_name widgets.org;
rewrite ^:8180.* https://purple-server.com break;
return 301 https://blue-server.com;



Result:



  • Typing widgets.org into a browser redirects to blue-server.com. Good.

  • Typing widgets.org:8180 into a browser hangs and eventually times not. Not so good.









share|improve this question







New contributor




relizt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Did you restart nginx after making the changes? Is nginx actually listening on that ports? Are any errors about the ports in the log files of nginx?

    – Gerald Schneider
    19 hours ago






  • 1





    Please be aware that a Permanent Redirect (a redirect with HTTP response code 301) is exactly that: permanent. Such a redirect will be cached by all common web browsers. - If you made a mistake in your server configuration and don't clear your caches (or don't do each new test in a new anonymous/incognito/private window) then any changes you make in the server configuration won't become apparent as your webbrowser will both use the stale cached redirect and change the request you enter in the URL bar for you even before it gets sent to a server.

    – HBruijn
    19 hours ago











  • Did you check if the port is opened by nginx? Can you show the output of netstat -anp | grep :8180

    – unNamed
    19 hours ago











  • Also note that a timeout usually points to a firewall issue. Since all your requests to 8180 time out I assume that you forgot to open the port in your firewall.

    – Gerald Schneider
    19 hours ago











  • That's a firewall problem, most likely. Go there first.

    – Michael Hampton
    18 hours ago















0















My organization has a server that is just for handling redirects of retired sites (redirects-myorg.org). We've just retired a website (widgets.org), and I am adding the retired site to our redirects server. About a week ago, we had the CNAME record for widgets.org changed so that it points to redirects-myorg.org.



Most of the URLs that were in circulation for widgets.org looked something like: widgets.org:8180/more/info. The 8180 port was explicitly included in the URL.



Success looks like:



  • Typing widgets.org into a browser: redirects to blue-server.com.

  • Typing widgets.org:8180 into a browser: redirects to purple-server.com

(For additional context: Three other sites' redirects are managed on this redirects server, and their configuration files reference ports 80 and 443. None of those sites use non-standard ports like 8180.)



Attempts



1.
I first set up the nginx configuration files to list to ports 80 and 8180 and return a 301 redirect on each:



server 
listen 8180;
listen [::]:8180;
server_name widgets.org;
return 301 https://purple-server.com;

server
listen 80;
listen [::]:80;
server_name widgets.org;
return 301 https://blue-server.com;



Result:



  • Typing widgets.org into a browser: redirects to blue-server.com. Good.

  • Typing widgets.org:8180 into a browser: hangs and eventually times not. Not so good.

2.
Tried switching the order, unsuccessfully:



server 
listen 80;
listen [::]:80;
server_name widgets.org;
return 301 https://blue-server.com;

server
listen 8180;
listen [::]:8180;
server_name widgets.org;
return 301 https://purple-server.com;



Result:



  • Same as above.

3.
Tried tricking nginx, unsuccessfully:



server 
listen 80;
listen [::]:80;
server_name widgets.org:8180;
return 301 https://purple-server.com;



Result:



  • Typing widgets.org into a browser: "Welcome to nginx!" page. Not so good.

  • Typing widgets.org:8180 into a browser: hangs and eventually times not. Not so good.

4.
Tried tricking nginx a different way, unsuccessfully:



server 
listen 80;
listen [::]:80;
server_name widgets.org;
rewrite ^:8180.* https://purple-server.com break;
return 301 https://blue-server.com;



Result:



  • Typing widgets.org into a browser redirects to blue-server.com. Good.

  • Typing widgets.org:8180 into a browser hangs and eventually times not. Not so good.









share|improve this question







New contributor




relizt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Did you restart nginx after making the changes? Is nginx actually listening on that ports? Are any errors about the ports in the log files of nginx?

    – Gerald Schneider
    19 hours ago






  • 1





    Please be aware that a Permanent Redirect (a redirect with HTTP response code 301) is exactly that: permanent. Such a redirect will be cached by all common web browsers. - If you made a mistake in your server configuration and don't clear your caches (or don't do each new test in a new anonymous/incognito/private window) then any changes you make in the server configuration won't become apparent as your webbrowser will both use the stale cached redirect and change the request you enter in the URL bar for you even before it gets sent to a server.

    – HBruijn
    19 hours ago











  • Did you check if the port is opened by nginx? Can you show the output of netstat -anp | grep :8180

    – unNamed
    19 hours ago











  • Also note that a timeout usually points to a firewall issue. Since all your requests to 8180 time out I assume that you forgot to open the port in your firewall.

    – Gerald Schneider
    19 hours ago











  • That's a firewall problem, most likely. Go there first.

    – Michael Hampton
    18 hours ago













0












0








0








My organization has a server that is just for handling redirects of retired sites (redirects-myorg.org). We've just retired a website (widgets.org), and I am adding the retired site to our redirects server. About a week ago, we had the CNAME record for widgets.org changed so that it points to redirects-myorg.org.



Most of the URLs that were in circulation for widgets.org looked something like: widgets.org:8180/more/info. The 8180 port was explicitly included in the URL.



Success looks like:



  • Typing widgets.org into a browser: redirects to blue-server.com.

  • Typing widgets.org:8180 into a browser: redirects to purple-server.com

(For additional context: Three other sites' redirects are managed on this redirects server, and their configuration files reference ports 80 and 443. None of those sites use non-standard ports like 8180.)



Attempts



1.
I first set up the nginx configuration files to list to ports 80 and 8180 and return a 301 redirect on each:



server 
listen 8180;
listen [::]:8180;
server_name widgets.org;
return 301 https://purple-server.com;

server
listen 80;
listen [::]:80;
server_name widgets.org;
return 301 https://blue-server.com;



Result:



  • Typing widgets.org into a browser: redirects to blue-server.com. Good.

  • Typing widgets.org:8180 into a browser: hangs and eventually times not. Not so good.

2.
Tried switching the order, unsuccessfully:



server 
listen 80;
listen [::]:80;
server_name widgets.org;
return 301 https://blue-server.com;

server
listen 8180;
listen [::]:8180;
server_name widgets.org;
return 301 https://purple-server.com;



Result:



  • Same as above.

3.
Tried tricking nginx, unsuccessfully:



server 
listen 80;
listen [::]:80;
server_name widgets.org:8180;
return 301 https://purple-server.com;



Result:



  • Typing widgets.org into a browser: "Welcome to nginx!" page. Not so good.

  • Typing widgets.org:8180 into a browser: hangs and eventually times not. Not so good.

4.
Tried tricking nginx a different way, unsuccessfully:



server 
listen 80;
listen [::]:80;
server_name widgets.org;
rewrite ^:8180.* https://purple-server.com break;
return 301 https://blue-server.com;



Result:



  • Typing widgets.org into a browser redirects to blue-server.com. Good.

  • Typing widgets.org:8180 into a browser hangs and eventually times not. Not so good.









share|improve this question







New contributor




relizt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












My organization has a server that is just for handling redirects of retired sites (redirects-myorg.org). We've just retired a website (widgets.org), and I am adding the retired site to our redirects server. About a week ago, we had the CNAME record for widgets.org changed so that it points to redirects-myorg.org.



Most of the URLs that were in circulation for widgets.org looked something like: widgets.org:8180/more/info. The 8180 port was explicitly included in the URL.



Success looks like:



  • Typing widgets.org into a browser: redirects to blue-server.com.

  • Typing widgets.org:8180 into a browser: redirects to purple-server.com

(For additional context: Three other sites' redirects are managed on this redirects server, and their configuration files reference ports 80 and 443. None of those sites use non-standard ports like 8180.)



Attempts



1.
I first set up the nginx configuration files to list to ports 80 and 8180 and return a 301 redirect on each:



server 
listen 8180;
listen [::]:8180;
server_name widgets.org;
return 301 https://purple-server.com;

server
listen 80;
listen [::]:80;
server_name widgets.org;
return 301 https://blue-server.com;



Result:



  • Typing widgets.org into a browser: redirects to blue-server.com. Good.

  • Typing widgets.org:8180 into a browser: hangs and eventually times not. Not so good.

2.
Tried switching the order, unsuccessfully:



server 
listen 80;
listen [::]:80;
server_name widgets.org;
return 301 https://blue-server.com;

server
listen 8180;
listen [::]:8180;
server_name widgets.org;
return 301 https://purple-server.com;



Result:



  • Same as above.

3.
Tried tricking nginx, unsuccessfully:



server 
listen 80;
listen [::]:80;
server_name widgets.org:8180;
return 301 https://purple-server.com;



Result:



  • Typing widgets.org into a browser: "Welcome to nginx!" page. Not so good.

  • Typing widgets.org:8180 into a browser: hangs and eventually times not. Not so good.

4.
Tried tricking nginx a different way, unsuccessfully:



server 
listen 80;
listen [::]:80;
server_name widgets.org;
rewrite ^:8180.* https://purple-server.com break;
return 301 https://blue-server.com;



Result:



  • Typing widgets.org into a browser redirects to blue-server.com. Good.

  • Typing widgets.org:8180 into a browser hangs and eventually times not. Not so good.






nginx port 301-redirect






share|improve this question







New contributor




relizt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




relizt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




relizt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 20 hours ago









reliztrelizt

1




1




New contributor




relizt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





relizt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






relizt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Did you restart nginx after making the changes? Is nginx actually listening on that ports? Are any errors about the ports in the log files of nginx?

    – Gerald Schneider
    19 hours ago






  • 1





    Please be aware that a Permanent Redirect (a redirect with HTTP response code 301) is exactly that: permanent. Such a redirect will be cached by all common web browsers. - If you made a mistake in your server configuration and don't clear your caches (or don't do each new test in a new anonymous/incognito/private window) then any changes you make in the server configuration won't become apparent as your webbrowser will both use the stale cached redirect and change the request you enter in the URL bar for you even before it gets sent to a server.

    – HBruijn
    19 hours ago











  • Did you check if the port is opened by nginx? Can you show the output of netstat -anp | grep :8180

    – unNamed
    19 hours ago











  • Also note that a timeout usually points to a firewall issue. Since all your requests to 8180 time out I assume that you forgot to open the port in your firewall.

    – Gerald Schneider
    19 hours ago











  • That's a firewall problem, most likely. Go there first.

    – Michael Hampton
    18 hours ago

















  • Did you restart nginx after making the changes? Is nginx actually listening on that ports? Are any errors about the ports in the log files of nginx?

    – Gerald Schneider
    19 hours ago






  • 1





    Please be aware that a Permanent Redirect (a redirect with HTTP response code 301) is exactly that: permanent. Such a redirect will be cached by all common web browsers. - If you made a mistake in your server configuration and don't clear your caches (or don't do each new test in a new anonymous/incognito/private window) then any changes you make in the server configuration won't become apparent as your webbrowser will both use the stale cached redirect and change the request you enter in the URL bar for you even before it gets sent to a server.

    – HBruijn
    19 hours ago











  • Did you check if the port is opened by nginx? Can you show the output of netstat -anp | grep :8180

    – unNamed
    19 hours ago











  • Also note that a timeout usually points to a firewall issue. Since all your requests to 8180 time out I assume that you forgot to open the port in your firewall.

    – Gerald Schneider
    19 hours ago











  • That's a firewall problem, most likely. Go there first.

    – Michael Hampton
    18 hours ago
















Did you restart nginx after making the changes? Is nginx actually listening on that ports? Are any errors about the ports in the log files of nginx?

– Gerald Schneider
19 hours ago





Did you restart nginx after making the changes? Is nginx actually listening on that ports? Are any errors about the ports in the log files of nginx?

– Gerald Schneider
19 hours ago




1




1





Please be aware that a Permanent Redirect (a redirect with HTTP response code 301) is exactly that: permanent. Such a redirect will be cached by all common web browsers. - If you made a mistake in your server configuration and don't clear your caches (or don't do each new test in a new anonymous/incognito/private window) then any changes you make in the server configuration won't become apparent as your webbrowser will both use the stale cached redirect and change the request you enter in the URL bar for you even before it gets sent to a server.

– HBruijn
19 hours ago





Please be aware that a Permanent Redirect (a redirect with HTTP response code 301) is exactly that: permanent. Such a redirect will be cached by all common web browsers. - If you made a mistake in your server configuration and don't clear your caches (or don't do each new test in a new anonymous/incognito/private window) then any changes you make in the server configuration won't become apparent as your webbrowser will both use the stale cached redirect and change the request you enter in the URL bar for you even before it gets sent to a server.

– HBruijn
19 hours ago













Did you check if the port is opened by nginx? Can you show the output of netstat -anp | grep :8180

– unNamed
19 hours ago





Did you check if the port is opened by nginx? Can you show the output of netstat -anp | grep :8180

– unNamed
19 hours ago













Also note that a timeout usually points to a firewall issue. Since all your requests to 8180 time out I assume that you forgot to open the port in your firewall.

– Gerald Schneider
19 hours ago





Also note that a timeout usually points to a firewall issue. Since all your requests to 8180 time out I assume that you forgot to open the port in your firewall.

– Gerald Schneider
19 hours ago













That's a firewall problem, most likely. Go there first.

– Michael Hampton
18 hours ago





That's a firewall problem, most likely. Go there first.

– Michael Hampton
18 hours ago










0






active

oldest

votes












Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






relizt is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f960402%2fnginx-wont-listen-on-non-standard-port%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes








relizt is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















relizt is a new contributor. Be nice, and check out our Code of Conduct.












relizt is a new contributor. Be nice, and check out our Code of Conduct.











relizt is a new contributor. Be nice, and check out our Code of Conduct.














Thanks for contributing an answer to Server Fault!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f960402%2fnginx-wont-listen-on-non-standard-port%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to write a 12-bar blues melodyI-IV-V blues progressionHow to play the bridges in a standard blues progressionHow does Gdim7 fit in C# minor?question on a certain chord progressionMusicology of Melody12 bar blues, spread rhythm: alternative to 6th chord to avoid finger stretchChord progressions/ Root key/ MelodiesHow to put chords (POP-EDM) under a given lead vocal melody (starting from a good knowledge in music theory)Are there “rules” for improvising with the minor pentatonic scale over 12-bar shuffle?Confusion about blues scale and chords

What if the end-user didn't have the required library?What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?

Why did Thanos need his ship to help him in the battle scene?Which actor plays Thanos in the Avengers mid-credits scene?Are there economic implications portrayed in comics where the buildings and cities are ruined almost daily?Old X-Men comic where team travels to alien world with a ring-like sun that needs recharging?Why does Ego need help sleeping?Is there an objective answer to who “the strongest Avenger” is?How did Banner get unstuck?Why did Thanos get hit?How did Thanos (or anyone) know the Infinity Stones would give him this power?Did Thanos leave Eitri alive for his after-sales service?In Avengers 1, why does Thanos need Loki?