LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   apache 2 problem (ssi) (https://www.linuxquestions.org/questions/linux-software-2/apache-2-problem-ssi-352777/)

snip128 08-13-2005 02:55 AM

apache 2 problem (ssi)
 
ok, i have a webpage, using modified headers and footers for directory listing...part of the header includes..

Code:

<!--#echo var="REQUEST_URI" -->
from what i understand, in order to make that display the current path, i need to have ssi (server side includes) up and running...i have added..

Code:

AddType text/html .shtml
AddHandler server-parsed .shtml

to both the apache.conf and "default" site configuration...i linked /etc/apache2/mods-available/include.load to /etc/apache2/mods-enabled/include.load, so the include_module should be running. I have also added Options +Includes to the default site file under <Directory /> and <Directory /var/www> sections...the files with <!--#echo var="REQUEST_URI" --> are shtml files... (.header.shtml and .readme.shtml)...it still only says "index of" and leaves the rest blank (in the source, the words index of are before <!--#echo var="REQUEST_URI" -->) soo...it'd be nice if i could get this working...do i need something besides ssi to get this working? did i miss configuring something?

thx for the help,
chris

oh, im running debian linux in case that matters.. >.>

eerwitt 08-13-2005 08:45 PM

In apache2 I usually take out:
AddHandler server-parsed .shtml
And leave in the AddType text/html .shtml

Also make sure you do not have any other Options overriding the option for +Includes. So for example I would have something like this, I also think debian sarge requires IncludesNoExec to be on:

AddType text/html .shtml
NameVirtualHost *
<VirtualHost *>
DocumentRoot /var/www/
<Directory />
Options +Includes IncludesNoExec FollowSymLinks
SetOutputFilter INCLUDES
AllowOverride None
</Directory>
</VirtualHost>

I would test with something simple like:
<!--#echo var="DATE_LOCAL" -->

The last thing I would check is to make sure the link is correct, if it is creating a problem look for a sigfault in the errorlog.

snip128 08-14-2005 12:57 AM

ummm ok! the <!--#echo var="DATE_LOCAL" --> WORKED! but the <!--#echo var="REQUEST_URI" --> still doesnt...i coulda sworn that was in a list of ssi commands...do i have to configure it or something? is there something besides ssi that would do it??

EDIT: hmmm...ok im getting somewhere now...it doesnt work in subdirectories! it treats it as a comment from subdirectories...does that help any? it only works if the script is in a file in /var/www...

eerwitt 08-14-2005 12:03 PM

Hrmm, it sounds like either you have an Options statement overriding those subdirectories or you have set it up to only be the root directory. It would be nice if you uploaded your config. Otherwise if I were configuring my root directory and all other directories to be ssi I would have the following directory block in my config:
NameVirtualHost *
<VirtualHost *>
DocumentRoot /var/www/
<Directory /var/www/>
Options +Includes IncludesNoExec FollowSymLinks
SetOutputFilter INCLUDES
AllowOverride None
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel debug
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>

:)

snip128 08-14-2005 12:43 PM

heres the config files :)

apache2.conf

default site configuration

hehe, i forget why i needed to add the /var/www/uftp sdirectory to the site config lol..nd in apache2.conf, ignore the sun lines LOL i deleted those cuz it misconfigured... >.>

eerwitt 08-14-2005 01:15 PM

For the virtual host config file change:
<Directory />
Options FollowSymLinks
AllowOverride none
#AddType text/html .shtml
#AddHandler server-parsed .shtml
SetOutputFilter INCLUDES
</Directory>
To:
<Directory />
Options Indexes FollowSymLinks +Includes IncludesNoExec
AllowOverride none
SetOutputFilter INCLUDES
</Directory>


And Change This:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews +Includes
AllowOverride all
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
# RedirectMatch ^/$ /apache2-default/
AddType text/html .shtml
AddHandler server-parsed .shtml
</Directory>
To:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews +Includes IncludesNoExec
SetOutputFilter INCLUDES
AllowOverride all
Order allow,deny
allow from all
</Directory>

Give that a try and I believe it will work.

snip128 08-14-2005 02:41 PM

nope, still doesnt work =/ eh i think i found the problem though...

.htaccess files

im still trying to figure out how these work...i used to think that i needed them in every directory so that the index directory listing will load the readme.shtml and header.shtml but i deleted them, and it still uses the header and readme like 3 subdirectories down...and the script doesnt work...but anyway, when i put the .htaccess file i use in /var/www the ssi no longer works...

so basically, is there somewhere i can specify for it to use the .readme.shtml and .header.shtml in ever directory, so i can delete the .htaccess files (the easy way), or is there a way i can add a directive or something to the .htaccess files to make it work? (the hard way)

eerwitt 08-14-2005 02:47 PM

Yes, you can put directives directly into your htaccess file. In this case those htaccess files probably have an option directive that is overriding the one in your config file. Make sure the option directives in your .htaccess files have the following:
Options +Includes

I am not sure as to what you mean by using the .readme.shtml files. Hrmm, ;)

snip128 08-14-2005 03:49 PM

i cant add +Options to .htaccess files =/ when i do it says "Internal Server Error" blah blah blah lol umm...yea..the .header.shtml and .readme.shtml just add a header and footer to the index directory listing, and makes the directory listing use the style of the .header.shtml file, effectively making them look very nice..this is whats in my .htaccess file..

Code:

Options Indexes
IndexOptions -FancyIndexing +IgnoreCase +SuppressDescription NameWidth=* +SuppressHTMLPreamble +FoldersFirst
HeaderName .header.shtml
ReadmeName .readme.shtml


eerwitt 08-14-2005 05:44 PM

For the .htaccess file you would add +Includes under the already existing Options directive like so
Options Indexes +Includes IncludesNoExec
IndexOptions -FancyIndexing +IgnoreCase +SuppressDescription NameWidth=* +SuppressHTMLPreamble +FoldersFirst
HeaderName .header.shtml
ReadmeName .readme.shtml
Or you can just put the HeaderName and ReadmeName under the main config like so and not use your .htaccess:
<IfModule mod_autoindex.c>
IndexOptions FancyIndexing IgnoreCase VersionSort SuppressHTMLPreamble
ReadmeName /var/www/footer.shtml
HeaderName /var/www/header.shtml
</IfModule>

snip128 08-14-2005 09:45 PM

yea, i just redid the .htaccess files...since it apparently controls all the subdirectories though, it was extremely easy...works just great now, thanks a lot for all your help eerwitt! :D

eerwitt 08-14-2005 10:09 PM

No prob, glad it works. :)


All times are GMT -5. The time now is 08:54 PM.