You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rich Bowen <rb...@rcbowen.com> on 2003/03/08 19:52:39 UTC

[PATCH] Remove Port from httpd.conf

It has irritated me for a while that the default Apache 1.3
configuration contains the Port directive, when the documentation says
not to use it. Does anyone object to this:

Index: httpd.conf-dist
===================================================================
RCS file: /home/cvs/apache-1.3/conf/httpd.conf-dist,v
retrieving revision 1.83
diff -B -b -u -r1.83 httpd.conf-dist
--- httpd.conf-dist	28 Feb 2003 13:36:03 -0000	1.83
+++ httpd.conf-dist	8 Mar 2003 18:49:54 -0000
@@ -173,6 +173,7 @@
 #
 #Listen 3000
 #Listen 12.34.56.78:80
+Listen 80

 #
 # BindAddress: You can support virtual hosts with this option. This directive
@@ -224,12 +225,6 @@
 # effect since their settings are defined by the inetd configuration.
 # Skip ahead to the ServerAdmin directive.
 #
-
-#
-# Port: The port to which the standalone server listens. For
-# ports < 1023, you will need httpd to be run as root initially.
-#
-Port 80

 #
 # If you wish httpd to run as a different user or group, you must run

-- 
Who can say where the road goes
Where the day flows
Only time
 --Pilgrim (Enya - A Day Without Rain)

Re: [PATCH] Remove Port from httpd.conf

Posted by Ask Bjoern Hansen <as...@develooper.com>.
On Mon, 10 Mar 2003, Rich Bowen wrote:

> > I was under the impression that Port was necessary in some situations,
> > in just the same way as ServerName.  For example, if you accept requests
> > on many ports, but you always want to issue redirects to one particular
> > port.
>
> This is not the case in practice. On my servers, I tend to run stuff on
> several ports - for testing purposes or whatnot - and I never use Port
> in my configurations, just Listen. However, I also always have
> UseCanonicalName Off, so I may be just a little confused here too. I'll
> experiment some more with this, and get back to you.

It's an issue when the server runs on a high port (say
127.0.0.1:8000), but users access it on port <routable ip>:80 (and
then forwarded by the kernel or a front end proxy).

Without the port statement, self referencing redirects (say from
/dir to /dir/) will go out with port 8000 on them.


 - ask

-- 
ask bjoern hansen, http://www.askbjoernhansen.com/ !try; do();

Re: [PATCH] Remove Port from httpd.conf

Posted by Rich Bowen <rb...@rcbowen.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sun, 9 Mar 2003, Joshua Slive wrote:

>
> On Sat, 8 Mar 2003, Rich Bowen wrote:
>
> > It has irritated me for a while that the default Apache 1.3
> > configuration contains the Port directive, when the documentation says
> > not to use it. Does anyone object to this:
>
> Could you point me to those docs?

I find that I'm now rather confused, as I can't find the actual doc
anywhere that says this. Although the documentation for Port itself now
confuses me a great deal. I think that I'm jumbling 2.x and 1.3 in my
mind.

> I was under the impression that Port was necessary in some situations,
> in just the same way as ServerName.  For example, if you accept requests
> on many ports, but you always want to issue redirects to one particular
> port.

This is not the case in practice. On my servers, I tend to run stuff on
several ports - for testing purposes or whatnot - and I never use Port
in my configurations, just Listen. However, I also always have
UseCanonicalName Off, so I may be just a little confused here too. I'll
experiment some more with this, and get back to you.

- -- 
Rich Bowen - rbowen@rcbowen.com
http://kenya.rcbowen.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Made with pgp4pine 1.75-6

iD8DBQE+bJTsXP03+sx4yJMRAkWNAJ9t16eX7AkB/6nd0ZZowDsYCXGBzACeJOkg
7FBcIUPEF3SXKNQKziV2naU=
=fhhK
-----END PGP SIGNATURE-----


Re: [PATCH] Remove Port from httpd.conf

Posted by Joshua Slive <jo...@slive.ca>.
On Sat, 8 Mar 2003, Rich Bowen wrote:

> It has irritated me for a while that the default Apache 1.3
> configuration contains the Port directive, when the documentation says
> not to use it. Does anyone object to this:

Could you point me to those docs?

I was under the impression that Port was necessary in some situations,
in just the same way as ServerName.  For example, if you accept requests
on many ports, but you always want to issue redirects to one particular
port.

Joshua.

Re: [PATCH] Remove Port from httpd.conf

Posted by Thom May <th...@planetarytramp.net>.
* Rich Bowen (rbowen@rcbowen.com) wrote :
> It has irritated me for a while that the default Apache 1.3
> configuration contains the Port directive, when the documentation says
> not to use it. Does anyone object to this:
> 
+1 to this change.
-Thom

Re: [PATCH] Remove Port from httpd.conf

Posted by Rich Bowen <rb...@rcbowen.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, 8 Mar 2003, William A. Rowe, Jr. wrote:

> IIUC, we still require Port for any non-standard listeners to create the correct
> server name (e.g. http://ServerName:Port/{redirect}) references.

Well, I always remove the Port directive and replace it with a Listen
directive (ie, I use this patch on live systems) and even those running
on non-standard ports seem to redirect to the right places.

> If this is not true, then I agree, remove it.  But do we now pick up the Port
> from the ServerName directive in 1.3?

I don't specifically know the answer to this, but it Works For Me. I'll
wait to see if anyone thinks that this will cause a problem.

> If they can follow the Apache 2 conventions, it makes migration easier, so
> if my fears are unfounded, +1.

- -- 
Rich Bowen
Apache - mod_perl - Perl - CGI
http://www.ApacheAdmin.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Made with pgp4pine 1.75-6

iD8DBQE+apwjXP03+sx4yJMRAgOfAJ9PuzfhQTDqyxkvkePB3c5rB6OuOQCggC8R
N69mx6SUW6uhNZ06emo030k=
=yMDm
-----END PGP SIGNATURE-----


Re: [PATCH] Remove Port from httpd.conf

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
IIUC, we still require Port for any non-standard listeners to create the correct
server name (e.g. http://ServerName:Port/{redirect}) references.

If this is not true, then I agree, remove it.  But do we now pick up the Port
from the ServerName directive in 1.3?

If they can follow the Apache 2 conventions, it makes migration easier, so
if my fears are unfounded, +1.

Bill

At 12:52 PM 3/8/2003, Rich Bowen wrote:
>It has irritated me for a while that the default Apache 1.3
>configuration contains the Port directive, when the documentation says
>not to use it. Does anyone object to this:
>
>Index: httpd.conf-dist
>===================================================================
>RCS file: /home/cvs/apache-1.3/conf/httpd.conf-dist,v
>retrieving revision 1.83
>diff -B -b -u -r1.83 httpd.conf-dist
>--- httpd.conf-dist     28 Feb 2003 13:36:03 -0000      1.83
>+++ httpd.conf-dist     8 Mar 2003 18:49:54 -0000
>@@ -173,6 +173,7 @@
> #
> #Listen 3000
> #Listen 12.34.56.78:80
>+Listen 80
>
> #
> # BindAddress: You can support virtual hosts with this option. This directive
>@@ -224,12 +225,6 @@
> # effect since their settings are defined by the inetd configuration.
> # Skip ahead to the ServerAdmin directive.
> #
>-
>-#
>-# Port: The port to which the standalone server listens. For
>-# ports < 1023, you will need httpd to be run as root initially.
>-#
>-Port 80
>
> #
> # If you wish httpd to run as a different user or group, you must run
>
>-- 
>Who can say where the road goes
>Where the day flows
>Only time
> --Pilgrim (Enya - A Day Without Rain)



Re: [PATCH] Remove Port from httpd.conf

Posted by Rich Bowen <rb...@rcbowen.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sun, 9 Mar 2003, Rich Bowen wrote:

> Perhaps for a version or two we need Port and BindAddress in there, with
> the deprecated messages, because people expect to see them, and then
> remove them entirely in some future version.

OK, how's this as a compromise:

Index: httpd.conf-dist
===================================================================
RCS file: /home/cvs/apache-1.3/conf/httpd.conf-dist,v
retrieving revision 1.83
diff -B -b -u -r1.83 httpd.conf-dist
- --- httpd.conf-dist	28 Feb 2003 13:36:03 -0000	1.83
+++ httpd.conf-dist	9 Mar 2003 13:41:46 -0000
@@ -173,16 +173,25 @@
 #
 #Listen 3000
 #Listen 12.34.56.78:80
+Listen 80

 #
 # BindAddress: You can support virtual hosts with this option. This directive
 # is used to tell the server which IP address to listen to. It can either
 # contain "*", an IP address, or a fully qualified Internet domain name.
+# BindAddress is deprecated, and you should use Listen instead.
 # See also the <VirtualHost> and Listen directives.
 #
 #BindAddress *

 #
+# Port: The port to which the standalone server listens. For
+# ports < 1023, you will need httpd to be run as root initially.
+# Port is deprecated, and you should use Listen instead
+#
+#Port 80
+
+#
 # Dynamic Shared Object (DSO) Support
 #
 # To be able to use the functionality of a module which was built as a DSO you
@@ -224,12 +233,6 @@
 # effect since their settings are defined by the inetd configuration.
 # Skip ahead to the ServerAdmin directive.
 #
- -
- -#
- -# Port: The port to which the standalone server listens. For
- -# ports < 1023, you will need httpd to be run as root initially.
- -#
- -Port 80

 #
 # If you wish httpd to run as a different user or group, you must run

- -- 
Rich Bowen - rbowen@rcbowen.com
ReefKnot - http://www.reefknot.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Made with pgp4pine 1.75-6

iD8DBQE+a0TfXP03+sx4yJMRAuRvAJ9JixWroO64PKpJ8fWt2AW0wC7F+gCg3dEg
2uWZ/h5TK3TecqRcnyuZDk0=
=44c4
-----END PGP SIGNATURE-----


Re: [PATCH] Remove Port from httpd.conf

Posted by Rich Bowen <rb...@rcbowen.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sun, 9 Mar 2003, Dirk-Willem van Gulik wrote:

>
>
> > not to use it. Does anyone object to this:
>
> Go for it - or even add a comment to below:
>
> > -# Port: The port to which the standalone server listens. For
> > -# ports < 1023, you will need httpd to be run as root initially.
> > -#
>
> which says - use listen, port is depcricated.

Well, perhaps, I suppose. I'd really like to see deprecated directives
not mentioned at all in the default config file. If people shouldn't be
using them, why even bring it up? The default conf does not contain all
directives -- just those needed for a default installation. And it
should be our first advocate for best practice in configuration files.

And while we're on the topic of Port and Listen, it occurs to me that
BindAddress does not really belong in the default config, even commented
out.

Perhaps for a version or two we need Port and BindAddress in there, with
the deprecated messages, because people expect to see them, and then
remove them entirely in some future version.

- -- 
Rich Bowen - rbowen@rcbowen.com
As we trace our own few circles around the sun
We get it backwards and our seven years go by like one
	Dog Years (Rush - Test for Echo - 1999)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Made with pgp4pine 1.75-6

iD8DBQE+a0QPXP03+sx4yJMRAgfIAJ9ea2dZU/dkbemThXUz/7cunkkm6wCfWTtp
ZYlc4P0c3B0NEbWfTIiay3g=
=B9aJ
-----END PGP SIGNATURE-----


Re: [PATCH] Remove Port from httpd.conf

Posted by Dirk-Willem van Gulik <di...@webweaving.org>.

> not to use it. Does anyone object to this:

Go for it - or even add a comment to below:

> -# Port: The port to which the standalone server listens. For
> -# ports < 1023, you will need httpd to be run as root initially.
> -#

which says - use listen, port is depcricated.

Dw