Apache, suexec and virtual hosts
I have recompiled apache for suexec to use /home as DocumentRoot.
I am trying to get suexec to work and have success when I use one
virtual host with the following configuration:
-------------------
In /opt/apache/conf/httpd.conf I have inter alia:
-------------
NameVirtualHost *
...
Include httpd.d
-------------
In httpd.d I have jspies.apache with the following content:
--------------------------
Alias /jspies /home/jspies/public_html
<VirtualHost *>
DocumentRoot /home/jspies/public_html
ServerName jspies
ErrorLog /usr/local/apache/logs/error_log
TransferLog /usr/local/apache/logs/access_log
User jspies
Group jspies
<Directory "/home/jspies/public_html">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ScriptAlias /jspies/ "/home/jspies/cgi-bin/"
<Directory "/home/jspies/cgi-bin">
AllowOverride None
Options None
Options +ExecCGI
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
--------------------------
So far so good. Suexec works and the following there is one virtual
host (I have configured apache to use port 81 here as for testing
purposes):
------------------------
$ /usr/local/apache/bin/httpd -S Processing config directory:
/usr/local/apache/conf/httpd.d
Processing config file: /usr/local/apache/conf/httpd.d/jspies.apache
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:81 is a NameVirtualHost
default server jspies
(/usr/local/apache/conf/httpd.d/jspies.apache:13)
port 81 namevhost jspies
(/usr/local/apache/conf/httpd.d/jspies.apache:13)
-----------------------
Now copy jspies.apache to js.apache and rename all the "jspies"
strings to "js", restart apache. There should be two virtual hosts
now: jspies and js.
Restart apache and do a "httpd -S" again:
-------------------------------
Processing config directory: /usr/local/apache/conf/httpd.d
Processing config file: /usr/local/apache/conf/httpd.d/js.apache
Processing config file: /usr/local/apache/conf/httpd.d/jspies.apache
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:81 is a NameVirtualHost
default server js
(/usr/local/apache/conf/httpd.d/js.apache:13)
port 81 namevhost js
(/usr/local/apache/conf/httpd.d/js.apache:13)
port 81 namevhost jspies
(/usr/local/apache/conf/httpd.d/jspies.apache:13)
-----------------------------------------
Only the virtual host for js gets recognized and the cgi-test for
jspies no longer works (I just did a "reload" on my browser):
----------
[Mon Feb 17 11:13:47 2003] [error] [client 146.232.128.37] File does
not exist:
/home/jspies/public_html/hello.cgi
---------
The point is that hello.cgi is in cgi-bin, not in public_html and when
jspies is the only virtual host defined, that is where apache finds it
and suexec executes it.
Suexec works for js however. I suspect it is because js.apache will
be read before jspies.apache when it is included in the configuration.
----------------
146.232.128.37 - - [17/Feb/2003:11:16:51 +0200] "GET /js/hello.cgi
HTTP/1.0" 200 13
----------------
And in the suexec log:
------
[2003-02-17 11:16:51]: info: (target/actual) uid: (js/js) gid: (js/js) cmd: hello.cgi
------
I have spent many hours in trying to solve this and will appreciate
some help please.
Regards.
Johann
--
Johann Spies Telefoon: 021-808 4036
Informasietegnologie, Universiteit van Stellenbosch
"Surely he took up our infirmities and carried our
sorrows; yet we considered him stricken by God,
smitten by him, and afflicted. But he was pierced for
our transgressions, he was crushed for our iniquities;
the punishment that brought us peace was upon him, and
by his wounds we are healed." Isaiah 53:4,5
Reply to: