Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Wed Jul 29, 2009 9:26 pm 
Offline
Senior Newbie

Joined: Wed Jul 29, 2009 7:50 pm
Posts: 10
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
Code:
sudo a2enmod include



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

Code:
# 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/

 <VirtualHost *:80>
    # 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.


Top
   
 Post subject:
PostPosted: Thu Jul 30, 2009 6:54 pm 
Offline
Senior Newbie

Joined: Wed Jul 29, 2009 7:50 pm
Posts: 10
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?


Top
   
 Post subject:
PostPosted: Sat Aug 01, 2009 12:28 pm 
Offline
Senior Newbie

Joined: Wed Jul 29, 2009 7:50 pm
Posts: 10
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..


Top
   
 Post subject:
PostPosted: Sat Aug 01, 2009 3:29 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
Did you restart Apache after enabling the include module?
Code:
/etc/init.d/apache2 restart


Top
   
 Post subject:
PostPosted: Sat Aug 01, 2009 5:07 pm 
Offline
Senior Newbie

Joined: Wed Jul 29, 2009 7:50 pm
Posts: 10
Yep. I've rebooted the whole server.


Top
   
 Post subject:
PostPosted: Sat Aug 01, 2009 5:52 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
Try adding the following lines to your virtual host configuration, just below the "options" and "allowoverride" lines.

Code:
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml


Top
   
 Post subject:
PostPosted: Sat Aug 01, 2009 6:01 pm 
Offline
Senior Newbie

Joined: Wed Jul 29, 2009 7:50 pm
Posts: 10
Doesn't seem to have an effect.

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

Code:
<!--#echo var="DATE_LOCAL" -->


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


Top
   
 Post subject:
PostPosted: Sat Aug 01, 2009 9:14 pm 
Offline
Senior Member
User avatar

Joined: Tue Aug 17, 2004 11:37 pm
Posts: 262
Website: http://www.our-lan.com
WLM: nf@our-lan.com
Location: Brisbane, Australia
whats the extention of your file?

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

_________________
ServerAdmin - www.our-lan.com
"Diplomacy is the art of saying nice doggy whilst looking for a really big stick"
"In my experiece, any attempt to make any system idiot proof will only challenge God to make a better idiot"


Top
   
 Post subject:
PostPosted: Sun Aug 02, 2009 12:49 am 
Offline
Senior Newbie

Joined: Wed Jul 29, 2009 7:50 pm
Posts: 10
some shtml, some php... but, it isn't limited to file includes. no ssi directives are being parsed.


Top
   
 Post subject:
PostPosted: Sun Aug 02, 2009 5:56 am 
Offline
Senior Member

Joined: Sun Aug 31, 2008 4:29 pm
Posts: 177
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.


Top
   
 Post subject:
PostPosted: Sun Aug 02, 2009 12:28 pm 
Offline
Senior Newbie

Joined: Wed Jul 29, 2009 7:50 pm
Posts: 10
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.


Top
   
 Post subject:
PostPosted: Sun Aug 02, 2009 1:16 pm 
Offline
Senior Member

Joined: Sun Aug 31, 2008 4:29 pm
Posts: 177
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:

Code:
[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:

Code:
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):

Code:
<Directory /some/path/here>
Options +Includes
</Directory>


4. An HTML file with the extension ".shtml". An example include might be:
Code:
 "<!--#echo var="DATE_LOCAL" --> ".


Top
   
 Post subject:
PostPosted: Sun Aug 02, 2009 1:29 pm 
Offline
Senior Newbie

Joined: Wed Jul 29, 2009 7:50 pm
Posts: 10
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

Code:
                AddType text/html .html
                AddOutputFilter INCLUDES .html



Thanks everyone!


Top
   
 Post subject:
PostPosted: Sun Aug 02, 2009 1:58 pm 
Offline
Senior Member

Joined: Sun Aug 31, 2008 4:29 pm
Posts: 177
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":

Quote:
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.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group