Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 13th February 2006, 05:21
jchaven jchaven is offline
Junior Member
 
Join Date: Feb 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default SSI with Apache2 on Debian

I have several .shtml pages that I have moved from Apache2 on Windows to Apache2 on Debian that are not loading. I can visit the individual pages that are included on the index page and they load normally -- they just do get included.

With Apache2 on Windows I configured SSI using the "httpd.conf" file just as in Apache1. On Debian it appears Apache is configured with the config "apache2.conf" instead of "httpd.conf" -- there is no apache2.conf on my Windows machine.

Furthermore, it appears Apache2 is automatically configured to parse .shtml files. According to information found on the Apache2 documentation site to enable SSI I have to use the httpd.conf or .htaccess files:

http://httpd.apache.org/docs/2.0/howto/ssi.html
"To permit SSI on your server, you must have the following directive either in your httpd.conf file, or in a .htaccess file: Options +Includes"


Yet, according to the comments in the /etc/apache2/httpd.conf file this is only meant for backward compatibility:
# This is here for backwards compatability reasons and to support

And according to the Apache2 documentation you should never use .htaccess:

http://httpd.apache.org/docs/2.0/howto/htaccess.html
"In general, you should never use .htaccess files unless you don't have access to the main server configuration file."


So, what am I supposed to do? Should I edit the httpd.conf? Use .htaccess? I would like to configure this the recommended way but, the documentation appears to contradict itself.

Thanks in advance,
Joey
Reply With Quote
Sponsored Links
  #2  
Old 13th February 2006, 09:27
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,740 Times in 2,575 Posts
Default

Quote:
Originally Posted by jchaven
I have several .shtml pages that I have moved from Apache2 on Windows to Apache2 on Debian that are not loading. I can visit the individual pages that are included on the index page and they load normally -- they just do get included.
Do you get any errors?

Quote:
Originally Posted by jchaven
With Apache2 on Windows I configured SSI using the "httpd.conf" file just as in Apache1. On Debian it appears Apache is configured with the config "apache2.conf" instead of "httpd.conf" -- there is no apache2.conf on my Windows machine.
Yes, on Debian Sarge with Apache 2 it's apache2.conf instead of httpd.conf.


Quote:
Originally Posted by jchaven
So, what am I supposed to do? Should I edit the httpd.conf? Use .htaccess? I would like to configure this the recommended way but, the documentation appears to contradict itself.

Thanks in advance,
Joey
Normally, you would edit apache2.conf. But I don't think you must change anything in apache2.conf - I've never had problems with SSI in the standard configuration on Debian. I think the problem is that you did not enable the include module. Please run this:

Code:
a2enmod include
and restart Apche.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 13th February 2006, 14:49
jchaven jchaven is offline
Junior Member
 
Join Date: Feb 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Did not work.

Here is what I did:
debian:/usr/sbin# a2enmod include
Module include installed; run /etc/init.d/apache2 force-reload to enable.
debian:/usr/sbin# apache2ctl -k restart

Here is what is in test.shtml:
<TITLE></TITLE>
</HEAD>
<BODY>
THIS IS TEST.SHTML
<HR>MENU:<br>
<!-- #include file="menu.html" -->
<HR>FILE 1:<br>
<!-- #include virtual="/mrtg/file1.html" -->
<HR>FILE 2:<br>
<!-- #include virtual="http://221.21.21.4/mrtg/file2.html" -->

this is the end
</BODY>
</HTML>


The output is all the HTML including rules. Nothing in the html files appears.

Thanks for your help!
Joey
Reply With Quote
  #4  
Old 13th February 2006, 17:58
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,740 Times in 2,575 Posts
Default

Do you have these lines in apache2.conf?

Code:
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #5  
Old 14th February 2006, 03:08
jchaven jchaven is offline
Junior Member
 
Join Date: Feb 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes. Here are the lines from the config:

Code:
# To use server-parsed HTML files
#
<FilesMatch "\.shtml(\..+)?$">
    SetOutputFilter INCLUDES
</FilesMatch>

AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

Here is an entry from the log that may help:
Code:
mod_include: Options +Includes (or IncludesNoExec) wasn't set, INCLUDES filter removed

Here are the only lines in the config that reference "IncludesNoExec":
Code:
<IfModule mod_negotiation.c>
<IfModule mod_include.c>
    Alias /error/ "/usr/share/apache2/error/"

    <Directory "/usr/share/apache2/error">
        AllowOverride None
        Options IncludesNoExec
        AddOutputFilter Includes html
        AddHandler type-map var
        Order allow,deny
        Allow from all
        LanguagePriority en es de fr
        ForceLanguagePriority Prefer Fallback
    </Directory>

    ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
    ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
    ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
    ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
    ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
    ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
    ErrorDocument 410 /error/HTTP_GONE.html.var
    ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
    ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
    ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
    ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
    ErrorDocument 415 /error/HTTP_SERVICE_UNAVAILABLE.html.var
    ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
    ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
    ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
    ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
    ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var

</IfModule>
</IfModule>

DirectoryIndex index.html index.shtml index.cgi index.pl index.php index.xhtml

# UserDir is now a module
#UserDir public_html
#UserDir disabled root

#<Directory /home/*/public_html>
#	AllowOverride FileInfo AuthConfig Limit
#	Options Indexes SymLinksIfOwnerMatch IncludesNoExec
#</Directory>
Thanks again,
Joey
Reply With Quote
  #6  
Old 14th February 2006, 04:28
jchaven jchaven is offline
Junior Member
 
Join Date: Feb 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I got it working but, I don't know why. I had to add the following to the apache2.conf:
Code:
<Directory /var/www/*>
     Options +Includes
     AddType text/html .shtml
     AddOutputFilter INCLUDES .shtml
</Directory>
Why didn't the following existing config work:
Code:
# To use server-parsed HTML files
#
<FilesMatch "\.shtml(\..+)?$">
    SetOutputFilter INCLUDES
</FilesMatch>

AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
I appreciate your help anyway.

Thanks!
Joey
Reply With Quote
  #7  
Old 25th August 2008, 17:06
Luckyfox Luckyfox is offline
Junior Member
 
Join Date: Aug 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Fixed

Quote:
Originally Posted by jchaven View Post
Did not work.

Here is what I did:
debian:/usr/sbin# a2enmod include
Module include installed; run /etc/init.d/apache2 force-reload to enable.
debian:/usr/sbin# apache2ctl -k restart

Here is what is in test.shtml:
<TITLE></TITLE>
</HEAD>
<BODY>
THIS IS TEST.SHTML
<HR>MENU:<br>
<!-- #include file="menu.html" -->
<HR>FILE 1:<br>
<!-- #include virtual="/mrtg/file1.html" -->
<HR>FILE 2:<br>
<!-- #include virtual="http://221.21.21.4/mrtg/file2.html" -->

this is the end
</BODY>
</HTML>


The output is all the HTML including rules. Nothing in the html files appears.

Thanks for your help!
Joey
I know this might sound obvious but I missed it Make sure you use single quotes not double quotes eg:

<!-- #include file="menu.html" --> = Wrong
<!-- #include file='menu.html' --> = CORRECT

Worked for me

Nigel
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The Perfect Setup - Debian Woody (3.0)... sending mail from my XP box? ExCIA HOWTO-Related Questions 17 27th June 2007 18:31
PHP on Apache2 no longer works after ISPconfig azorman Installation/Configuration 6 23rd July 2006 22:06
e-mail problem!!! Debian 3.1 maroonworks Installation/Configuration 18 6th December 2005 14:42
Where to Start with Apache2? Vorlon Server Operation 2 20th October 2005 01:12
Perfect setup (debian sarge) Pelle Installation/Configuration 4 11th October 2005 17:17


All times are GMT +2. The time now is 15:44.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.