Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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.
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.
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.
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
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?
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.
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.
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
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.
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>
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.
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.
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>
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.