Can't get SSI working on Ubuntu 9.04

I have successfully installed Apache and PHP, and gotten a vhost set up. Flat files and PHP will execute, and all include files will run when navigated directly to.

I have run````
sudo a2enmod include

And this is the vhost that's in (or symlinked in) /etc/apache2/sites-enabled/

Place any notes or comments you have here

It will make any customisation easier to understand in the weeks to come

domain: mydomain.com

public: /var/www/mydomain.com/

# Admin email, Server Name (domain name) and any aliases
ServerAdmin mydomain@gmail.com
ServerName mydomain.com
ServerAlias www.mydomain.com

# Index file and Document Root (where the public files are located)
 DirectoryIndex index.html
 DocumentRoot /var/www/mydomain.com/httpdocs

    <directory var="" www="" mydomain.com="" httpdocs="">Options +Indexes +Includes +FollowSymLinks +MultiViews
            AllowOverride All
            Order allow,deny
            allow from all</directory> 

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

ErrorLog  /var/www/mydomain.com/log/error.log
CustomLog /var/www/mydomain.com/log/access.log combined</virtualhost> 

````

Any help would be greatly appreciated.

13 Replies

Hmm, this is crazy.

There's nothing in /etc/apache2/httpd.conf, and nothing referencing Includes in apache2.conf.

Is there anywhere else this could be getting overridden?

Well, thinking I may've made a mistake somewhere during the initial configuration, I just wiped and reinstalled my linode from scratch choosing Debian 5.0 this time. Followed the basic setup and apache install tutorials here, and I'm now back at the same place… No server side includes.

:(

I didn't set up a separate virtual host this time.. I'm working off of the default_site vhost that was set up and working with the default Debian install. I'm just adding +Includes to appropriate directory sections. Nothing is working though.

I have run a2enmod include, and the mod appears in mods-enabled.

I'm so lost here..

Did you restart Apache after enabling the include module?

/etc/init.d/apache2 restart

Yep. I've rebooted the whole server.

Try adding the following lines to your virtual host configuration, just below the "options" and "allowoverride" lines.

AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

Doesn't seem to have an effect.

I can't even output non file-include server side directives, like

The SSI code is not parsed, and is output in the HTML code.

whats the extention of your file?

The code that hybinet suggested only effects .shtml files..

some shtml, some php… but, it isn't limited to file includes. no ssi directives are being parsed.

Is there an .htaccess in the web directory, with an "Options" line? It might be overriding the Options setting in the virtualhost container and thereby disabling Includes.

There is no htaccess, I'm now working on the default-site that was installed with apache. I haven't added anything to apache2.conf or httpd.conf, and only added +Includes to /etc/apache2/sites-enabled/000-default.

I'm not familiar with how Debian or Ubuntu install Apache as I install it from source. But the essential prerequisites for server sides includes are:

1. mod_include compiled in Apache:

[root@vps] cd /usr/local/apache2/bin
[root@vps] ./httpd -l | grep mod_include
  mod_include.c

Your path to the httpd binary may be different. If you don't see "mod_include.c" then it's not compiled.

2. SSI directives active:

The following lines must appear in httpd.conf (for global application – i.e., all domains) or in a specific virtualhost:

AddType text/html .shtml
AddOutputFilter INCLUDES .shtml 

3. Option 'Includes' (or '+Includes' to merge it with existing options) for the directory where the file is being served (applies to subdirectories):

 <directory some="" path="" here="">Options +Includes</directory> 

4. An HTML file with the extension ".shtml". An example include might be:

 " ".

Yay!

I didn't understand the way output filters were working. I was trying to include .shtml files into an .html file… I was adding output filters for .shtml, but I needed to add

                AddType text/html .html
                AddOutputFilter INCLUDES .html

Thanks everyone!

Good that you got it working :) but parsing all .html files for ssi isn't really recommended.

Read http://httpd.apache.org/docs/2.0/howto/ssi.html

Scroll to the section "Configuring your server to permit SSI":

> You'll occasionally see people recommending that you just tell Apache to parse all .html files for SSI, so that you don't have to mess with .shtml file names. These folks have perhaps not heard about XBitHack. The thing to keep in mind is that, by doing this, you're requiring that Apache read through every single file that it sends out to clients, even if they don't contain any SSI directives. This can slow things down quite a bit, and is not a good idea.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct