Click to See Complete Forum and Search --> : Changing Webserver Port?


JohnDB
04-06-2001, 03:02 PM
I am running RedHat 7, and I need to change the port that the web server is running on, from port 80 to, say, port 8000. Can anybody point me to a method of doing this?

--John

FoBoT
04-06-2001, 03:10 PM
most likely you are running apache, so you need to edit the apache config file

i will have to look up where that is located, since i don't have a red hat 7 pc here

somebody else might post it

goozey
04-06-2001, 04:04 PM
edit your httpd.conf file (etc/httpd/conf/httpd.conf )

and look for the listen directive... (line 174 in my config) but should be 'near' the top...

# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the <VirtualHost>
# directive.
#
#Listen 3000
#Listen 12.34.56.78:80
Listen 80

FoBoT
04-06-2001, 04:06 PM
see, i knew one of the smart peeps would hook you up! :)

Craig McPherson
04-06-2001, 08:26 PM
Note that this only applies if you're running Apache as a standalone Daemon, rather than from a superserver (inetd, xinetd, et all). When Apache is run from an inetd, it ignores that line in the configuration file -- the superserver tells it what port to run on. If that's the case for you, you could edit your /etc/services and assign http to a different port, but you should never directly change anything in /etc/services because it'll screw up your system in other ways.

(Best to just run Apache as a standalone daemon if your web server is going to be getting much traffic at all. If you're only expecting 1 or 2 hits per day, though, you might be better off running it from inetd, to save memory.)

JohnDB
04-06-2001, 08:45 PM
Thank You! :D
It turns out that apache is running standalone, so I was able to change the port in the apache config file.

Thanks for the quick response!

--John

The King Ant
04-06-2001, 10:10 PM
/etc/services is just used as a reference for some programs which need a reference for ports n' stuff. (ie. using ip tables to block all "imap" connections, "imap" would be looked up in your /etc/services file.) It should not be used when starting services when people request things.

If Apache were running from a superserver, you would edit that program's config files (/etc/inetd.conf, etc.)

You still wouldn't want to change your /etc/services file, because most http daemons listen on port 80.

[ 06 April 2001: Message edited by: The King Ant ]