问题
I got the following error message in the Apache log:
unable to include potential exec "header.html" in parsed file /Users/sikusiku/Sites/ss-git/homepage.shtml
I basically tried to include header.html from homepage.shtml. I used the very basic directive in homepage.html (both header.html and homepage.shtml are located in the document root):
<!--#include virtual="header.html" -->
I think I have properly turned on the SSI in my httpd.conf:
Options Indexes FollowSymLinks ExecCGI Includes
...
AddType text/html .shtml
...
# XBitHack doesn't have anything to do with this, but I added it anyway.
XBitHack on
Did I miss anything? Does the included file i.e. header.html need to be configured differently?
回答1:
I just fixed this problem myself on ubuntu sever 11.10 with apache2.
my /etc/apache2/sites-available/default file:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
I changed AllowOverride None to All in /var/www directory directive.
my .htaccess file in /var/www/.htaccess:
Options +Includes
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
finally i made sure that include.load was in the mods-enabled folder this is to load the mod_includes.so module.
sudo ln -s /etc/apache2/mods-available/include.load /etc/apache2/mods-enabled/include.load
That creates a symbolic link to the include.load in mods-available.
finally restart apache
sudo service apache2 restart
That made it work for me, hope you get it working as well.
-- Thomas
来源:https://stackoverflow.com/questions/7462063/server-side-includes