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
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
New contributor
|
show 1 more comment
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
New contributor
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 ofnetstat -anp | grep :8180
– unNamed
19 hours ago
Also note that a timeout usually points to a firewall issue. Since all your requests to8180
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
|
show 1 more comment
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
New contributor
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
nginx port 301-redirect
New contributor
New contributor
New contributor
asked 20 hours ago
reliztrelizt
1
1
New contributor
New contributor
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 ofnetstat -anp | grep :8180
– unNamed
19 hours ago
Also note that a timeout usually points to a firewall issue. Since all your requests to8180
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
|
show 1 more comment
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 ofnetstat -anp | grep :8180
– unNamed
19 hours ago
Also note that a timeout usually points to a firewall issue. Since all your requests to8180
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
|
show 1 more comment
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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