You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by re...@newsguy.com on 2006/06/08 21:17:46 UTC

[users@httpd] Re: Serve /var/www and public_html

"David Salisbury" <sa...@globe.gov> writes:

> Well, you'd probably have to script alias every user's directory as well as the /var/... directory.
>
> But, you should be able to get around that with a
>
> AddHandler cgi-script cgi
>
> in your conf file.

At this point I do have that uncommented and I've gotten a little
further toward my goal.

I can now fire a cgi anywhere under $public_html and at 
  /var/www/localhost/cgi-bin.

But still nothing outside of /var/../cgi-bin/ will fire.

The directory settings look like 
  (some of it may be a bit overdone):

<Directory /var/www/localhost/htdocs>
    Options All MultiViews Indexes FollowSymLinks Includes ExecCGI
    AddHandler cgi-script .cgi 
    AllowOverride All
</Directory>

AddHandler cgi-script .cgi is also enabled outside that directory
setting.

Still cgi outside of /var/../cgi-bin/ under htdocs/ will not fire but
instead just display as a file.

the apache error_log says:
Options ExecCGI is off in this directory: /var/www/localhost/htdocs/exp/test.cgi, referer: http://reader.local.lan/exp/

But /var/www/localhost/htdocs should include any subdirectories right.

In httpd.conf is says:
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories). 
#

Adding that directory specifally (..htdocs/exp) in another `Directory'
statement does make cgi work there but that shuold just happen with
the above Directory statement right?


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Serve /var/www and public_html

Posted by Joshua Slive <jo...@slive.ca>.
On 6/9/06, reader@newsguy.com <re...@newsguy.com> wrote:
>
> > So you likely have another Options directive someplace.
>
> I'm not finding it but I don't know what 90% of this stuff does:
> I've removed charset, icon locale stuff.

It's probably in here someplace:

> Include /etc/apache2/vhosts.d/*.conf

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: Serve /var/www and public_html

Posted by re...@newsguy.com.
"David Salisbury" <sa...@globe.gov> writes:

>> Will a default setup allow me to fire cgi in these places:
>>
>> /var/www/localhost/cgi-bin
>> /var/www/localhost/htdocs (and all subdir)
>> ~/public_html (and all subdir)
>>
>> It appears not to here.
>>
>
> If you want cgi execution in /var/www/localhost/cgi-bin
> then why do you have
>
> <Directory "/var/www/localhost/cgi-bin/">
>    AllowOverride None
>    Options None
>    Order allow,deny
>    Allow from all
> </Directory>
>
> ????!

Apparently the setting of ScritpAlias to /cgi-bin/ still allows cgi to
fire there and I can run cgi there.  That was never mentioned as a
problem in this thread.  Far as I know what you quote above is stock
in the installed httpd.conf.

> Oh.. and what's in these:     Include /etc/apache2/vhosts.d/*.conf   ?
> Have you checked?

It turns out that was the rub.  It was not apparent to me that a
virtual host was even involved.  That default document appears to be
about using *:80 addressing scheme which I am not.

But the Directory statement in it is where things are now done.  

> Sorry but I wont be able to debug this for you with snippets, nor do
> I really want to pour over someone else's conf file :( as that
> sucks.  But it looks like you just need to rtfm and look carefully
> at what you're doing.

Sorry but as I'm sure you realize and as is always the case on usenet,
no one has asked you to debug or pour over anything.  Posts are put up
and people can respond if they like.  Inserting personal anecdotes
about what you think `sucks' isn't really the point.

Another common banality is RTFM from people who already understand
what is in the FM.  I have poured over large pieces of it and still
didn't get the fact that we are now using virtual host to mean the
main server running when we fire up apache.

I've found it is often true that what I read in the manual at some
previous time and didn't really get, suddenly takes on new or
different meaning from just a comment someone makes in usenet from
practicle experience.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Serve /var/www and public_html

Posted by David Salisbury <sa...@globe.gov>.
> Will a default setup allow me to fire cgi in these places:
> 
> /var/www/localhost/cgi-bin
> /var/www/localhost/htdocs (and all subdir)
> ~/public_html (and all subdir)
> 
> It appears not to here.
> 

If you want cgi execution in /var/www/localhost/cgi-bin
then why do you have

<Directory "/var/www/localhost/cgi-bin/">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

????!

Oh.. and what's in these:     Include /etc/apache2/vhosts.d/*.conf   ?
Have you checked?

Sorry but I wont be able to debug this for you with snippets, nor do I really want
to pour over someone else's conf file  :(   as that sucks.  But it looks like you just need
to rtfm and look carefully at what you're doing.

-ds



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: Serve /var/www and public_html

Posted by re...@newsguy.com.
"David Salisbury" <sa...@globe.gov> writes:

> I thought you said you had an AddHandler outside of the directory listings?
> I don't see it.

It must have fell victim to overzealous snippage... it is in there:

grep -n 'AddHandler cgi' /etc/apache2/httpd.conf
448:    AddHandler cgi-script .cgi 
453:    AddHandler cgi-script .cgi 
936:AddHandler cgi-script .cgi

> Also, if this is the conf, what's not working again?  What's the
> latest error log mssg?

Well, as explained in a couple of places earlier in the thread, I want
to be able to fire cgi anywhere under /var/www/localhost/htdocs and
$public_html.

At the thread has progressed, I've gotten closer and can now fire cgi
anywher under ~/public_html including subdir but only in
/var/www/localhost/cgi-bin on the site area.

That is, the ExecCGI for /var/www/localhost/htdocs doesn't get carried
over to any subdir without explicitly defining them too.  

> The options look okay in general.. but kind of scatter gunned.
> Looks to me like you could take them all out, and just go with the
> default...  read da manual.

Will a default setup allow me to fire cgi in these places:

/var/www/localhost/cgi-bin
/var/www/localhost/htdocs (and all subdir)
~/public_html (and all subdir)

It appears not to here.



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Serve /var/www and public_html

Posted by David Salisbury <sa...@globe.gov>.
I thought you said you had an AddHandler outside of the directory listings?
I don't see it.

Also, if this is the conf, what's not working again?  What's the latest error log mssg?

The options look okay in general.. but kind of scatter gunned.  Looks to me like you
could take them all out, and just go with the default...  read da manual.

Also, use AllowOverride None to start.. maybe you have some htaccess file
hanging around that's changing your options.

-ds


----- Original Message ----- 
From: <re...@newsguy.com>
To: <us...@httpd.apache.org>
Sent: Friday, June 09, 2006 4:47 AM
Subject: [users@httpd] Re: Serve /var/www and public_html


> "Joshua Slive" <jo...@slive.ca> writes:
> 
>>> So does that then mean that setting execCGI on
>>> /var/www/localhost/htdocs will not cover
>>> /var/www/localhost/htdocs/subdir?
>>
>> No.  You are correct in thinking that more specific <Directory>
>> sections override less-specific ones in general.  The specific
>> ordering is defined here:
>> http://httpd.apache.org/docs/2.2/sections.html#mergin
>>
>> So you likely have another Options directive someplace.
> 
> I'm not finding it but I don't know what 90% of this stuff does:
> I've removed charset, icon locale stuff.
> ====
> ServerRoot "/usr/lib/apache2"
> <IfModule !perchild.c>
>    #ScoreBoardFile /var/run/apache2_runtime_status
> </IfModule>
> PidFile "/var/run/apache2.pid"
> Timeout 300
> KeepAlive On
> MaxKeepAliveRequests 100
> KeepAliveTimeout 15
> Include /etc/apache2/modules.d/*.conf
> User apache
> Group apache
> ServerAdmin reader@localhost
> UseCanonicalName Off
> <Directory />
>    Options FollowSymLinks
>    AllowOverride None
> </Directory>
> <Directory /var/www/localhost/htdocs/>
>    Options All MultiViews Indexes FollowSymLinks Includes ExecCGI
>    AddHandler cgi-script .cgi 
>    AllowOverride All
> </Directory>
> <Directory /var/www/localhost/htdocs/exp>
>    Options All MultiViews Indexes FollowSymLinks Includes ExecCGI
>    AddHandler cgi-script .cgi 
>    AllowOverride All
> </Directory>
> <IfModule mod_userdir.c>
>    UserDir public_html
>    <Directory /home/*/public_html>
>        AllowOverride All
>        Options MultiViews Indexes SymLinksIfOwnerMatch Includes ExecCGI
>    </Directory>
> </IfModule>
> DirectoryIndex index.html index.html.var
> AccessFileName .htaccess
> <FilesMatch "^\.ht">
>    Order allow,deny
>    Deny from all
> </FilesMatch>
> TypesConfig /etc/mime.types
> DefaultType text/plain
> <IfModule mod_mime_magic.c>
>    MIMEMagicFile /etc/apache2/magic
> </IfModule>
> <Directory "/var/www/localhost/icons/">
>    Options Indexes MultiViews
>    AllowOverride None
>    Order allow,deny
>    Allow from all
> </Directory>
> ScriptAlias /cgi-bin/ /var/www/localhost/cgi-bin/
> <IfModule mod_cgid.c>
>    #Scriptsock            /var/run/cgisock
> </IfModule>
> <Directory "/var/www/localhost/cgi-bin/">
>    AllowOverride None
>    Options None
>    Order allow,deny
>    Allow from all
> </Directory>
> <IfModule mod_autoindex.c>
>    IndexOptions FancyIndexing VersionSort
> 
> [...]
> 
> <IfDefine INFO>
>    ExtendedStatus On
>    <Location /server-status>
>        SetHandler server-status
>        Order deny,allow
>        Deny from all
>        Allow from localhost
>    </Location>
> </IfDefine>
> <IfDefine INFO>
>    <Location /server-info>
>       SetHandler server-info
>       Order deny,allow
>       Deny from all
>       Allow from localhost
>    </Location>
> </IfDefine>
> Include /etc/apache2/vhosts.d/*.conf
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: Serve /var/www and public_html

Posted by re...@newsguy.com.
"Joshua Slive" <jo...@slive.ca> writes:

>> So does that then mean that setting execCGI on
>> /var/www/localhost/htdocs will not cover
>> /var/www/localhost/htdocs/subdir?
>
> No.  You are correct in thinking that more specific <Directory>
> sections override less-specific ones in general.  The specific
> ordering is defined here:
> http://httpd.apache.org/docs/2.2/sections.html#mergin
>
> So you likely have another Options directive someplace.

I'm not finding it but I don't know what 90% of this stuff does:
I've removed charset, icon locale stuff.
====
ServerRoot "/usr/lib/apache2"
<IfModule !perchild.c>
    #ScoreBoardFile /var/run/apache2_runtime_status
</IfModule>
PidFile "/var/run/apache2.pid"
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
Include /etc/apache2/modules.d/*.conf
User apache
Group apache
ServerAdmin reader@localhost
UseCanonicalName Off
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory /var/www/localhost/htdocs/>
    Options All MultiViews Indexes FollowSymLinks Includes ExecCGI
    AddHandler cgi-script .cgi 
    AllowOverride All
</Directory>
<Directory /var/www/localhost/htdocs/exp>
    Options All MultiViews Indexes FollowSymLinks Includes ExecCGI
    AddHandler cgi-script .cgi 
    AllowOverride All
</Directory>
<IfModule mod_userdir.c>
    UserDir public_html
    <Directory /home/*/public_html>
        AllowOverride All
        Options MultiViews Indexes SymLinksIfOwnerMatch Includes ExecCGI
    </Directory>
</IfModule>
DirectoryIndex index.html index.html.var
AccessFileName .htaccess
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
</FilesMatch>
TypesConfig /etc/mime.types
DefaultType text/plain
<IfModule mod_mime_magic.c>
    MIMEMagicFile /etc/apache2/magic
</IfModule>
<Directory "/var/www/localhost/icons/">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
ScriptAlias /cgi-bin/ /var/www/localhost/cgi-bin/
<IfModule mod_cgid.c>
    #Scriptsock            /var/run/cgisock
</IfModule>
<Directory "/var/www/localhost/cgi-bin/">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>
<IfModule mod_autoindex.c>
    IndexOptions FancyIndexing VersionSort

[...]

<IfDefine INFO>
    ExtendedStatus On
    <Location /server-status>
        SetHandler server-status
        Order deny,allow
        Deny from all
        Allow from localhost
    </Location>
</IfDefine>
<IfDefine INFO>
    <Location /server-info>
       SetHandler server-info
       Order deny,allow
       Deny from all
       Allow from localhost
    </Location>
</IfDefine>
Include /etc/apache2/vhosts.d/*.conf


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Serve /var/www and public_html

Posted by Joshua Slive <jo...@slive.ca>.
On 6/8/06, reader@newsguy.com <re...@newsguy.com> wrote:
> "Joshua Slive" <jo...@slive.ca> writes:
>
> [...]
>
> >> Adding that directory specifally (..htdocs/exp) in another `Directory'
> >> statement does make cgi work there but that shuold just happen with
> >> the above Directory statement right?
> >
> > Assuming you had *no other options directives*, then yes.  Your
> > problem is that you have another options directive someplace applying
> > to that directory and not including execcgi.
>
> OK, sorry to be such a pest here but let me make sure I got this
> right.
>
> There is a sort of generic default allow nothing Directory statement
> over '/'.
>
> <Directory />
>     Options FollowSymLinks
>     AllowOverride None
> </Directory>
>
> So does that then mean that setting execCGI on
> /var/www/localhost/htdocs will not cover
> /var/www/localhost/htdocs/subdir?

No.  You are correct in thinking that more specific <Directory>
sections override less-specific ones in general.  The specific
ordering is defined here:
http://httpd.apache.org/docs/2.2/sections.html#mergin

So you likely have another Options directive someplace.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: Serve /var/www and public_html

Posted by re...@newsguy.com.
"Joshua Slive" <jo...@slive.ca> writes:

[...]

>> Adding that directory specifally (..htdocs/exp) in another `Directory'
>> statement does make cgi work there but that shuold just happen with
>> the above Directory statement right?
>
> Assuming you had *no other options directives*, then yes.  Your
> problem is that you have another options directive someplace applying
> to that directory and not including execcgi.

OK, sorry to be such a pest here but let me make sure I got this
right.

There is a sort of generic default allow nothing Directory statement
over '/'.

<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

So does that then mean that setting execCGI on
/var/www/localhost/htdocs will not cover 
/var/www/localhost/htdocs/subdir?

So then I'd need to edit httpd.conf for any added directories?

If that is true its sort of surprising to me.... I don't recall having
this trouble in previous setups but then I haven't ever configured for 
public_html to be active before.  I've just done all my shenanigans
right in doc_root. /var/www/localhost/htdocs

I've mentioned earlier that my purpose here is to move possibly
damaging expermentation from /var/www/localhost/htdocs to 
~/public_html because I now have need of a reliable local lan page for
the family network and don't want to disrupt it with something
misguided like. `rm -rf $htdoc/*'  and have forgotten to define
$htdocs.

Yup, I've done it at least once.

For clarity here is there really any reason not to just add everything
I need at  .. like stick a bunch of permissive stuff in there.

<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

This is a single user machine.  It is on a network but there is no
chance barring a household takeover by terrorists or something that
any malicious things would be done thru the apache server.

It is shielded from the internet by a settop router/firewall.

Now some sort of mistaken action on the part of a local client could
happen but is that a real problem if I were to set:

<Directory />
    Options All execCGI
    AllowOverride All
</Directory>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Serve /var/www and public_html

Posted by Joshua Slive <jo...@slive.ca>.
On 6/8/06, reader@newsguy.com <re...@newsguy.com> wrote:

> the apache error_log says:
> Options ExecCGI is off in this directory: /var/www/localhost/htdocs/exp/test.cgi, referer: http://reader.local.lan/exp/
>
> But /var/www/localhost/htdocs should include any subdirectories right.
>
> In httpd.conf is says:
> # Each directory to which Apache has access can be configured with respect
> # to which services and features are allowed and/or disabled in that
> # directory (and its subdirectories).
> #
>
> Adding that directory specifally (..htdocs/exp) in another `Directory'
> statement does make cgi work there but that shuold just happen with
> the above Directory statement right?

Assuming you had *no other options directives*, then yes.  Your
problem is that you have another options directive someplace applying
to that directory and not including execcgi.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org