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

Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company