You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Gil Dawson <Gi...@GilDawson.com> on 2014/12/29 20:01:49 UTC
[users@httpd] Apache & Unix
Hi--
Apache V2.2 is running fine on my machine (a Mac Mini with MacOS 10.6.8).
I am reading the \private\etc\apache2\httpd,conf file to understand Apache.
I'm having a little problem understanding the Unix terminology.
Unix isn't my first language, so this is pretty sophisticated stuff for me.
Still, I thought I knew a little. I didn't realize how little until...
At line 13, I came across this paragraph:
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "/private/var/log/apache2/foo_log"
# with ServerRoot set to "/usr" will be interpreted by the
# server as "/usr//private/var/log/apache2/foo_log".
This paragraph has me stumped.
'...if the filenames ... begin with "/"'
-- I cannot imagine how a filename could begin with "/".
Does the author possibly mean pathname?
A pathname might begin with either a "/" or a "~", would it not?
"If the filenames do *not* begin with "/", ... "/private/var/log/apache2/foo_log"
-- This is an example of a filename that does not begin with "/", right?
I don't get it. I see "/" at the beginning of everything.
What would be an example of a filename that does begin with "/"?
"/usr//private/..."
-- What is the meaning of "//" in this context?
I'd appreciate an explanation or possibly a link to where I can read about these constructs.
Googling "unix pathnames" didn't pay off right away.
--Gil
Re: [users@httpd] Apache & Unix
Posted by Gil Dawson <Gi...@GilDawson.com>.
Excellent response, Mark!
Exactly what I needed.
Thank you.
--Gil
On Dec 29, 2014, at 11:40 AM, Mark Montague wrote:
> On 2014-12-29 14:01, Gil Dawson wrote:
>> I'm having a little problem understanding the Unix terminology.
>
> You may find Chapter 2 of the freely available book "The Linux Command Line" ( http://linuxcommand.org/tlcl.php ) to be helpful. Although this book is about Linux, not MacOS X, both are based on Unix.
>
>> This paragraph has me stumped.
>>
>> '...if the filenames ... begin with "/"'
>> --
>> I cannot imagine how a filename could begin with "/".
>> Does the author possibly mean pathname?
>> A pathname might begin with either a "/" or a "~", would it not?
>
> Configuration and log files are files, whereas pathnames can point to anything. So although it may be confusing, I think that "filename" is the correct terminology here. The filename may be just the name of a file without any directory component, or it may include a relative directory component or an absolute directory component. Examples:
>
> Simple filename: extra-stuff.conf (look for the file "extra-stuff.conf" inside the current directory)
>
> With relative directory: my-stuff/extra-stuff.conf (look for the file "extra-stuff.conf" inside the directory "my-stuff" which in turn is in the current directory"). Note that this is the same as ./my-stuff/extra-stuff.conf
>
> Another example with a relative directory: ../../another-place/extra-stuff.conf (go up two directory levels from the current directory, then into the directory "another-place" and then the file is extra-stuff.conf).
>
> Absolute directory component: /private/etc/apache2/extra-stuff.conf
>
>>
>> "If the filenames do *not* begin with "/", ... "/private/var/log/apache2/foo_log"
>> -- This is an example of a filename that does not begin with "/", right?
>> I don't get it. I see "/" at the beginning of everything.
>> What would be an example of a filename that does begin with "/"?
>
> /private/var/log/apache2/foo_log" *does* begin with "/". You're trying to make too much of a distinction between pathnames and filenames.
>
>> "/usr//private/..."
>> -- What is the meaning of "//" in this context?
>
> It has no meaning, extra slashes between directory components are ignored. This lets scripts and other programs construct filenames without having to detect and remove extraneous slashes; if a script always adds a slash, it will be there when needed and won't cause problems if it is not needed. The following are all equivalent:
>
> /usr/private
> /usr//private
> /usr/private/
> /////usr/////private/////
>
> For more reading, see http://teaching.idallen.com/cst8207/12f/notes/160_pathnames.html
>
> --
> Mark Montague
> mark@catseye.org
Re: [users@httpd] Apache & Unix
Posted by Mark Montague <ma...@catseye.org>.
On 2014-12-29 14:01, Gil Dawson wrote:
> I'm having a little problem understanding the Unix terminology.
You may find Chapter 2 of the freely available book "The Linux Command
Line" ( http://linuxcommand.org/tlcl.php ) to be helpful. Although this
book is about Linux, not MacOS X, both are based on Unix.
> This paragraph has me stumped.
>
> '...if the filenames ... begin with "/"'
>
> --I cannot imagine how a filename could begin with "/".
>
> Does the author possibly mean /pathname/?
>
> A pathname might begin with either a "/" or a "~", would it not?
>
Configuration and log files are files, whereas pathnames can point to
anything. So although it may be confusing, I think that "filename" is
the correct terminology here. The filename may be just the name of a
file without any directory component, or it may include a relative
directory component or an absolute directory component. Examples:
Simple filename: extra-stuff.conf (look for the file
"extra-stuff.conf" inside the current directory)
With relative directory: my-stuff/extra-stuff.conf (look for the file
"extra-stuff.conf" inside the directory "my-stuff" which in turn is in
the current directory"). Note that this is the same as
./my-stuff/extra-stuff.conf
Another example with a relative directory:
../../another-place/extra-stuff.conf (go up two directory levels from
the current directory, then into the directory "another-place" and then
the file is extra-stuff.conf).
Absolute directory component: /private/etc/apache2/extra-stuff.conf
>
> "If the filenames do *not* begin with "/", ...
> "/private/var/log/apache2/foo_log"
>
> --This is an example of a filename that does not begin with
> "/", right?
> I don't get it. I see "/" at the beginning of everything.
> What would be an example of a filename that /does/ begin with "/"?
>
/private/var/log/apache2/foo_log" *does* begin with "/". You're trying
to make too much of a distinction between pathnames and filenames.
> "/usr//private/..."
>
> -- What is the meaning of "//" in this context?
>
It has no meaning, extra slashes between directory components are
ignored. This lets scripts and other programs construct filenames
without having to detect and remove extraneous slashes; if a script
always adds a slash, it will be there when needed and won't cause
problems if it is not needed. The following are all equivalent:
/usr/private
/usr//private
/usr/private/
/////usr/////private/////
For more reading, see
http://teaching.idallen.com/cst8207/12f/notes/160_pathnames.html
--
Mark Montague
mark@catseye.org
[users@httpd] Re: Apache & Unix
Posted by LuKreme <kr...@kreme.com>.
On Dec 29, 2014, at 12:01 PM, Gil Dawson <Gi...@GilDawson.com> wrote:
> Apache V2.2 is running fine on my machine (a Mac Mini with MacOS 10.6.8).
>
> I am reading the \private\etc\apache2\httpd,conf file to understand Apache.
Curious, why are you typing \’s for paths?
--
Indecision is the key to flexibility.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org