LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 11-04-2009, 08:29 PM   #1
lilmike
Member
 
Registered: Nov 2009
Location: Baton Rouge, Louisiana
Distribution: Ubuntu
Posts: 56

Rep: Reputation: 15
Question apache 2 not recognizing .shtml files


Hi,
I have just changed my web pages mostly to .shtml to take advantage of ssi.
Now, when I go to my website, it gives an "index of /" page instead of showing the .shtml files.
I have read in many places that .shtml files have to be specifically set up to be recognized as index files, but I cannot for the life of me get it to work or even to understand where I'm supposed to put all of the configuration stuff.
I need to know what to change to make the apache 2 parse .shtml files for ssi and also to make apache check for .shtml files as an index file.
Any help would be appreciated.
Thanks,
-Michael.
P.S. I would also like to know how to make it so it will not by default show an "index of /" or whatever page when it does not find an index file.
Also, I would need to know how to turn off this behavior for a particular directory.
 
Old 11-05-2009, 12:17 AM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,937

Rep: Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330
Hi,

You have to add index.shtml in the DirectoryIndex directive.

For apache to parse .shtml pages (pages with ssi includes) you need to add
Code:
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
among the other AddType directives and the keyword "Includes" to the Options of the DocumentRoot directory.

If you don't want apache to do a directory listing when it cannot find an index page, then you have to remove the keyword "Indexes" from the Options of that directory.
 
Old 11-05-2009, 07:45 PM   #3
lilmike
Member
 
Registered: Nov 2009
Location: Baton Rouge, Louisiana
Distribution: Ubuntu
Posts: 56

Original Poster
Rep: Reputation: 15
Question

Hi,
Can you give me an example of a configuration file with this included.
Also, where should I put it, in httpd.conf, in a specific website file, in apache2.conf, or what.
Also, if it is httpd.conf, which one, the one under /etc/apache2 or /etc/apache2/conf.d
So if you could help me by providing an example, that would be nice.
-Michael.
 
Old 11-05-2009, 08:08 PM   #4
jmc1987
Member
 
Registered: Sep 2009
Location: Oklahoma
Distribution: Debian, CentOS, windows 7
Posts: 866

Rep: Reputation: 110Reputation: 110
Quote:
Originally Posted by lilmike View Post
Hi,
Can you give me an example of a configuration file with this included.
Also, where should I put it, in httpd.conf, in a specific website file, in apache2.conf, or what.
Also, if it is httpd.conf, which one, the one under /etc/apache2 or /etc/apache2/conf.d
So if you could help me by providing an example, that would be nice.
-Michael.

There is actually 3 configuration files from when NCSA was writing it. They are still there but apache now recommends just using the httpd.conf only. So edit /etc/apache2/conf.d

Nope I guess they took the 2 other conf files out. So just httpd.conf is the one you still want to edit anyways

Last edited by jmc1987; 11-05-2009 at 08:22 PM.
 
Old 11-05-2009, 08:46 PM   #5
lilmike
Member
 
Registered: Nov 2009
Location: Baton Rouge, Louisiana
Distribution: Ubuntu
Posts: 56

Original Poster
Rep: Reputation: 15
Question

mmk,
Now how about an example, I am hopelessly lost around these conf files.
Any help would be appreciated.
-Michael.
 
Old 11-05-2009, 10:00 PM   #6
parkprimus
LQ Newbie
 
Registered: Nov 2009
Posts: 4

Rep: Reputation: 0
Did you google?

go to http://httpd.apache.org/docs/2.0/mod/mod_include.html and follow the documentation. If you make a change to a config you have to restart the service. But I have to ask why do you want to enable .shtml. You know if is for service side inludes, right?
 
Old 11-06-2009, 02:19 PM   #7
lilmike
Member
 
Registered: Nov 2009
Location: Baton Rouge, Louisiana
Distribution: Ubuntu
Posts: 56

Original Poster
Rep: Reputation: 15
Smile

Quote:
Originally Posted by parkprimus View Post
go to http://httpd.apache.org/docs/2.0/mod/mod_include.html and follow the documentation. If you make a change to a config you have to restart the service. But I have to ask why do you want to enable .shtml. You know if is for service side inludes, right?
Hi,
Yes I know this is for server side includes, that is what I have in my .shtml pages, that's why I need it enabled.
I will try the link you posted.
Thanks,
-Michael.
 
Old 11-06-2009, 04:03 PM   #8
lilmike
Member
 
Registered: Nov 2009
Location: Baton Rouge, Louisiana
Distribution: Ubuntu
Posts: 56

Original Poster
Rep: Reputation: 15
Unhappy

Hi,
I went there, and under the enabling server side includes, it said basically what everyone has told me to do, but nothing about where to put it, or what to put around it, or anything.
If someone could give an example of a typical conf file, that would be nice.
Also, I have placed that text in /etc/apache2/conf.d/httpd.conf and in /etc/apache2/httpd.conf and in /etc/apache2/sites-available/<mysite.mytld> but none of it seems to work.
I reloaded and sometimes restarted the server after each changed.
Any help is appreciated.
-Michael.
 
Old 11-06-2009, 04:21 PM   #9
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,937

Rep: Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330
Hi,

I think that this could help you understand what you have to edit in order for apache to use SSI.

Regards
 
Old 11-06-2009, 07:59 PM   #10
lilmike
Member
 
Registered: Nov 2009
Location: Baton Rouge, Louisiana
Distribution: Ubuntu
Posts: 56

Original Poster
Rep: Reputation: 15
Question

Hi,
I've got a few questions about that website now.
Do those texts mentioned have to specifically be in the <directory /var/www/> or do they have to be in a <directory> tag that corrolates to your document root, such as <directory /websites/myhost.mydomain/public_html/> if my web files were in /websites/myhost.mydomain/public_html/
Because when I put them in the default file but put them in a <directory /websites/myhost.mydomain/public_html/> because that's my document root, it stills shows the index of /
Any help, is as always, appreciated.
-Michael.
P.S. Thanks alot to all the people who have helped thus far, and I hope you can put up with me a little bit more
 
Old 11-07-2009, 03:39 PM   #11
parkprimus
LQ Newbie
 
Registered: Nov 2009
Posts: 4

Rep: Reputation: 0
With in..

the <Directory> tag is a perfect place for the entry.
 
Old 11-08-2009, 11:46 AM   #12
lilmike
Member
 
Registered: Nov 2009
Location: Baton Rouge, Louisiana
Distribution: Ubuntu
Posts: 56

Original Poster
Rep: Reputation: 15
Hi,
Thanks for the note that the <directory> tag is the place to put it.
Unfortunately, it still isn't working.
I put the text on the website mentioned in a previous post in the <directory /websites/mtgames.org/public_html/> tag, and also in the <directory /var/www/> tag, but none of it works.
It should be noted that my files for the website are not in /var/www, but in /websites/mtgames.org/public_html/
I put the modifications in the mtgames.org virtual host file, and also in the default file.
When I just put it in the mtgames.org file, it still gives me an index of /.
When I put it in the default file, however, it says access forbidden.
I did, it should be noted, remove the options indexes directive, just to test.
Here is my virtual host file along with my default file, which are all the same.
Quote:
<VirtualHost *:80>
ServerAdmin webmaster@localhost

DocumentRoot /websites/mtgames.org/public_html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options FollowSymLinks MultiViews +Includes
AllowOverride None
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
AddOutputFilter INCLUDES .shtml
</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 /var/log/apache2/error.log

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

CustomLog /var/log/apache2/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>
Any help is appreciated and thanks for all the helpful responses.
-Michael.
 
Old 11-09-2009, 02:24 PM   #13
lilmike
Member
 
Registered: Nov 2009
Location: Baton Rouge, Louisiana
Distribution: Ubuntu
Posts: 56

Original Poster
Rep: Reputation: 15
Hi,
I am still having terrible trouble getting it to work.
I even tried using allowoverride all to do it in the .htaccess file, but no luck.
It still says access forbidden!
Any help is appreciated.
-Michael.
 
Old 11-09-2009, 04:27 PM   #14
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,937

Rep: Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330
Have you added index.shtml in the DirectoryIndex directive as pointed out in the 2nd post?
Another thing you should take care, is that you have "DocumentRoot /websites/mtgames.org/public_html" for your vhost, but you change things for "<Directory /var/www/>". And you need a ServerName.
Better use this:
Code:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "/websites/mtgames.org/public_html"
ServerName www.domain.com
<Directory "/websites/mtgames.org/public_html">
Options FollowSymLinks MultiViews +Includes
AllowOverride None
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
AddOutputFilter INCLUDES .shtml
</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 /var/log/apache2/error.log

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

CustomLog /var/log/apache2/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>

Last edited by bathory; 11-09-2009 at 04:42 PM.
 
Old 11-10-2009, 07:27 AM   #15
lilmike
Member
 
Registered: Nov 2009
Location: Baton Rouge, Louisiana
Distribution: Ubuntu
Posts: 56

Original Poster
Rep: Reputation: 15
Unhappy

Hi,
I did exactly as you said in your post, did the exact code you put there.
Still saying access forbidden!
I have the default and the mtgames.org page as the same thing, is that right?
Also, it makes me think I'm missing something I need to do before or after reloaded apache2
So, when I modify and save the file, I do this:
Quote:
/etc/init.d/apache2 reload
And then I visit the website, and it gives me the access forbidden!
I really don't know what's wrong, but I'm sure everyone is trying their best to help me.
Thanks for a speedy reply,
-Michael.
 
  


Reply

Tags
parkprimus


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
apache update stopped processing shtml files, need some advice. sir-lancealot Linux - Server 2 08-08-2008 01:55 PM
shtml on apache2 jsheffie Linux - Software 3 09-08-2005 07:56 PM
HELP: Apache not recognizing new directories daveselinger Linux - Software 1 01-16-2005 10:54 AM
Redhat 9.0 not recognizing executable files BenRichards Linux - Software 2 09-17-2004 03:25 PM
PHP or SHTML? SE optimization linuxfond Linux - Newbie 2 06-15-2004 02:40 AM


All times are GMT -5. The time now is 10:15 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration