Changing the default http port to another one.

  • Thread starter Thread starter heartless
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around changing the default HTTP port on a router to allow access to a server without being redirected to the router's management interface. Participants explore various methods for configuring both the router and the server, particularly focusing on Apache settings.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant seeks to change the default HTTP port from 80 to another port to prevent access to the router when trying to reach their server.
  • Another participant suggests that some routers allow changing the management port and recommends turning off remote management to avoid conflicts.
  • A participant outlines a typical router and server configuration, explaining how port forwarding works and how to access the server directly.
  • One user reports that their attempts to implement the suggested methods have failed, indicating they can still access the router remotely despite settings to prevent it.
  • Another participant advises on configuring Apache to listen on a different port, providing a link to documentation for guidance.
  • A user encounters an error when trying to set Apache to listen on port 668, suggesting a potential conflict with another service using that port.
  • Another participant speculates that the issue may be due to an incorrect directive in the Apache configuration, recommending the use of the "Port" directive instead of "Listen" for changing the listening port.
  • Concerns are raised about using ports below 1024, as they may be reserved by the operating system, with suggestions to use higher port numbers like 8080 or 8100.

Areas of Agreement / Disagreement

Participants express differing views on the best approach to configure the router and server, with no consensus reached on a definitive solution. Some methods proposed are contested based on individual experiences and outcomes.

Contextual Notes

There are unresolved issues regarding the specific router model and its capabilities, as well as potential conflicts with other services using the same ports. The discussion also highlights the need for clarity in configuration directives within Apache.

heartless
Messages
220
Reaction score
2
Hello,
I set up a server a while ago (I'm not very experienced in that kind of stuff). I have a router, and I forwarded ssh, smtp, and pop connections to the server, however my router provides an access to the settings through http, (http://192.168.1.1) and I'd like to change default http port (80) to 9999 or any others except for 80 so that the http is forwarded to my server. Right now, whenever I try to access my server, by domain, I get to the router which I don't want to be there. Any ideas how I can do that?

Thanks,
 
Last edited by a moderator:
Computer science news on Phys.org
Some routers (e.g. Netgear) allow you to change the port number for remote management, as well as restrict access to a certain set of IP addresses.

You could also do this...
turn off remote management. Then use (say) vnc or remote desktop (possibly via ssh) to access your computer and do the management locally. However, this may not work as well since your connection may drop if you need to reboot the router.
 
There's a couple of things to keep in mind. I'm assuming you have a configuration similar to the following:
Router:
. WAN IP 68.188.205.170 (given by yur ISP)
. LAN IP 192.168.1.1

Server:
. LAN IP 192.168.1.2

Most routers have HTTP based administration on port 80, as you mentioned, but usually only from the LAN side (WAN side administration has to be specificaly enabled, and it is usually over a custom port, like 8080). If you set your router to forward port 80 to your server then:
. 68.188.205.170:80 should take you to your server
. 192.168.1.1:80 should take you to the router's HTTP based administration
(Notice that port forwarding forwards requests on the specified ports from the WAN side only)
It's OK to have the router's HTTP based administration on port 80 from the LAN side, this should not cause any problems with your website. Also, forwarding port 80 won't make the router's HTTP based administration unavailable. So forward port 80 to your server, once you have that, then:
. http://68.188.205.170 will take you to your website
. http://192.168.1.2 will take you to your website
. http://localhost will take you to your website
. http://192.168.1.1 will take you to your router's HTTP based administration
. http://68.188.205.170:8080 will take you to your router's HTTP based administration (if you enable remote administration through port 8080).

You can also easily have your web server listening on some port other than 80, like 6969 and have your router forward WAN requests on port 80 to your server on port 6969.
 
Last edited by a moderator:
I tried this method above, but it ain't working. Although my router is set up not to allow remote administration, I still can access to it through my domain, from far, far away. Maybe the best thing would be to make apache listen onto another port, since my website is just for me and practice, and leave router at 80. It'd rather be more convenient for me to make my server listening to for example 666. But then again, how can I make apache listen to another port?
Thanks Job
 
To configure Apache to listen on a given port you have to edit the configuration file, i think it's httpd.config. You need to use the appropriate directive, here's some help:
http://httpd.apache.org/docs/2.2/bind.html

What kind of router do you have? Sounds like a strange router.
 
hmm it's quite weird. I wrote into httpd.conf Listen 668, but when I try to restart apache, I get:
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:668
no listening sockets available, shutting down

any ideas Job?

Thanks again,
 
Sounds like something else is using the port, or you didn't specify a valid interface address. I'm actually more of an IIS kind of guy. :smile:
 
heartless said:
hmm it's quite weird. I wrote into httpd.conf Listen 668,

No, what you want is the "Port" directive. (Gee, what an obscure name! :eek: ) Your httpd.conf almost certainly contains "Port 80" already. Just change the 80 to whatever new port you want and restart the server. Don't forget to tack the port number onto the host name or IP in the URL.

According to the Apache docs, you use the "Listen" directive when you want the server to listen to more than one port simultaneously, for example when you're running different virtual hosts on different ports.

Also, it's not a good idea to use a port below 1024, because those are often reserved by the operating system for other uses. Try something like 8080 or 8100 or 8000.
 
Last edited:

Similar threads

Replies
3
Views
4K
Replies
7
Views
3K
Replies
2
Views
1K
Replies
17
Views
2K
  • · Replies 35 ·
2
Replies
35
Views
7K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
Replies
4
Views
4K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K