Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Directory 1

Status
Not open for further replies.

purpleski

IS-IT--Management
Aug 14, 2002
112
0
0
FR
Hi

Another question. When I installed Apache I set it up so that the web site files are held in

C:\Program Files\Apache Group\Apache2\purpleski

I would prefer to have the files located at

E\websites\purpleski.

However if I put the files here while I can see the pages on the site at the server side includes do not work.

Is there a way to achieve this?

Thanks.
 
Of course. It's your server. One would think yo can do anything you want. :) You need Options + Includes in the Directory container where you want to allow ssi. If you want apache to only parse shtml files for ssi, then make sure you have the following lines:

AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

This will prevent apache from parsing everything under the sky.

 
Thanks for that but am a very untrained newbie and I am afraid I do not understand

You need Options + Includes in the Directory container where you want to allow ssi.

Can you explain?

Thanks.
 
For the sake of arguement, let's say your have the following directory structure:

e:/websites/purpleski and inside purpleski you have 3 sub-directories, html, cgi-bin and logs. I am going to assume that you may want to add other domains in the future, so I will put the information you need in a vhost container. Even if you just have one domain, it makes life a lot easier to see everything in one place when it comes time to edit the server's behavior. When you use vhosts, the "main" server will no longer be served. The first vhost defined will be the default in case there is no match for a requested domain. Getting back to "containers", containers are a way for apache to contain or regulate the scope of a directive. For example, the directive ServerName in the main section is not in a container so it is said to be "global" in scope. If you want this directive to apply to only one domain (virtual host), you would put it in what we call a vhost container. So now ServerName only applies to one domain. You can control access and who can do what in a directory by putting directives in a directory container. The scope of a directive applies to that directory and all it's sub-directories unless you create a new container with different directives. Most directives are explained where they are used in httpd.conf so you can use that as a reference to help you understand what is happening in the sample vhost container below. This is just a sample but you can copy and paste it to the bottom of your httpd.conf then edit it as needed. The first 2 directives are global and should already be defined in the main section. You may just need to uncomment them. The UseCanonicalNames directive needs to be turned off.


########################################################
# Start Virtual Hosts #
########################################################
NameVirtualHost *
UseCanonicalNames Off

<VirtualHost *>
ServerAdmin webmaster@purpleski.com
DocumentRoot e:/websites/purpleski/html
ServerName purpleski.com
ServerAlias ErrorLog e:/websites/purpleski/logs/error_log
CustomLog e:/websites/purpleski/logs/access_log combined

<Directory &quot;e:/websites/purpleski/html&quot;>

Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all

</Directory>

ScriptAlias /cgi-bin/ &quot;e:/websites/purpleski/cgi-bin/&quot;

<Directory &quot;e:/websites/purpleski/cgi-bin&quot;>

AllowOverride None
Options None
Order allow,deny
Allow from all

</Directory>


</VirtualHost>


After you edit httpd.conf you need to restart apache so it will read the new configs.
 
RhythmAce

Thank you for all that I have put the following at the end of httpd file

########################################################
# Start Virtual Hosts #
########################################################
NameVirtualHost *
UseCanonicalName Off

<VirtualHost *>
ServerAdmin webmaster@purpleski.com
DocumentRoot e:/websites/purpleski
ServerName purpleski.com
ServerAlias ErrorLog e:/websites/purpleski/logs/error_log
CustomLog e:/websites/purpleski/logs/access_log combined

<Directory &quot;e:/websites/purpleski&quot;>

Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all

</Directory>

ScriptAlias /cgi-bin/ &quot;e:/websites/purpleski/cgi-bin/&quot;

<Directory &quot;e:/websites/purpleski/cgi-bin&quot;>

AllowOverride None
Options None
Order allow,deny
Allow from all

</Directory>

AddType text/html .shtml .htm .html
AddOutputFilter INCLUDES .shtml .htm .html
AddHandler server-parsed .shtml


Options Indexes FollowSymLinks Includes
</VirtualHost>

And the site in e:/websites/purpleski is showing at localhost but the server side includes are not working any thoughts?

Thanks
 
I noticed that you have this line at the end of your vhost container:

Options Indexes FollowSymLinks Includes

This line should be inside of the container for the directory you want to allow ssi. For example, if you want to run them from the DocumentRoot, you will put it inside of the following container:

<Directory &quot;e:/websites/purpleski&quot;>

Options Indexes FollowSymLinks +Includes
AllowOverride None
Order allow,deny
Allow from all

</Directory>

My bad on the example I gave earlier. I forgot to add it in there.




 
RhythmAce

You are more than just a technical user!!! Thank you so much for you comprehensive answer that worked first time this is a post all first time apache users should read so that they understand how to set up the httpd.conf file.

Thank you again. I don't suppose you know the answer to my other post about seeing a web site over a lan (thread65-700208)thread65-700208 you do that would be great.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top