logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: SSIs not parsed by localhost:5501, SHTML files fail
Author
Dee



Joined: 19 Jun 2020
Posts: 6
Location: USA, NYC

PostPosted: Mon 29 Jun '20 15:48    Post subject: SSIs not parsed by localhost:5501, SHTML files fail Reply with quote

Running Apache v2.4 on a 64bit Win10 Pro v1909.

Files having .shtml extension in my root directory are not being parsed. Instead, the server is displaying the contents of the index.html file in the root directory.

The error.log file does not contain any entries on the dates when the default index.html file is being parsed in lieu of .shtml files.

I am applying the .shtml extension to files which contain SSIs like the following:

Code:
<!--#include virtual="/mainmenu.html" -->


I followed the "checklist" mentioned by Rahul Posted: Wed 13 Jun '07 13:21 subject: Problem with SSIs at https://www.apachelounge.com/viewtopic.php?t=1712&highlight=shtml+ssi even though I am not using XAMPP.

These same files are being parsed as intended by the Apache servers at my web host. In fact, .shtml files in subdirectories are also being properly parsed online.

Please tell me what I am missing.

Thank you,

Dee
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7294
Location: Germany, Next to Hamburg

PostPosted: Tue 30 Jun '20 22:50    Post subject: Reply with quote

Did you change the DirectoryIndex yet?

can you call it via http://your_IP/index.shtml directly?
Back to top
Dee



Joined: 19 Jun 2020
Posts: 6
Location: USA, NYC

PostPosted: Wed 01 Jul '20 22:11    Post subject: Reply with quote

James Blond wrote:
Did you change the DirectoryIndex yet?

Yes, I think so, but I'm not sure I did it correctly. Here are the relevant lines in C:\Apache24\conf\httpd.conf
Code:
<IfModule dir_module>
    DirectoryIndex index.html Jindex.shtml index.shtml
</IfModule>

Does that look correct to you?

James Blond wrote:

can you call it via http://your_IP/index.shtml directly?

I'm not sure what you mean by that. Yes, if I upload files to my web hosting company and address a browser to http://myDomain.com/index.shtml then SSIs are parsed correctly. If I enter file:///index.shtml in a local browser, the target page does display but the included SSI does not parse.

What did you mean by your_IP ?

When I try http://127.0.0.1/index.shtml I get error: "You don't have permission to access this resource."

When I try http://47.17.11.247/e:/index.shtml I get "404 Not Found". I just checked and my human-friendly connection to the internet is translated into 47.17.11.247 and the file is located in the root directory of my E drive.

Please explain what I'm doing wrong.

Thank you
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7294
Location: Germany, Next to Hamburg

PostPosted: Thu 02 Jul '20 9:25    Post subject: Reply with quote

If you want index.shtml served first, you need to put it in the first place for DirectoryIndex.

Quote:
http://47.17.11.247/e:/index.shtml


Apache doesn't wotk that way. You have to configure the path in DocumentRoot and place your files there.

If The drive e: is a network drive Apache can't access it when it is installed as the normal system account. Use local files or you have to create a new local user and change account for the Apache service.
Back to top
Dee



Joined: 19 Jun 2020
Posts: 6
Location: USA, NYC

PostPosted: Thu 02 Jul '20 20:03    Post subject: Reply with quote

Quote:
If you want index.shtml served first, you need to put it in the first place for DirectoryIndex.


OK, I changed the order as follows:
Code:
<IfModule dir_module>
    DirectoryIndex index.shtml index.html   
</IfModule>


Still no joy. When editing .shtml files in VS Code and opening them with Live Server (sending to Apache for parsing). Apache serves E:/Classiccars/Websites/Websites from c3ghz/Classicars Albums/index.html to my default browser (Chrome).


Quote:
Apache doesn't wotk that way. You have to configure the path in DocumentRoot and place your files there.


The root directory for my current project is:

E:/Classiccars/Websites/Websites from c3ghz/Classicars Albums/

When I installed the Apache server for the first time a few days ago, I edited httpd.conf as follows:

Code:
DocumentRoot "E:/Classiccars/Websites/Websites from c3ghz/Classicars Albums"


Quote:
If The drive e: is a network drive Apache can't access it when it is installed as the normal system account.

Drive E is not on a network. It is a partition on a HDD in the local PC. I tried http://47.17.11.247/e:/index.shtml only because you asked me
Quote:
can you call it via http://your_IP/index.shtml directly?


Maybe I didn't understand your question.

The project contains about 35,000 files -- mostly photos in about 400 albums. All files reside on my local PC in the root directory on the E drive as indicated above. Each album is in a subdirectory under the root along with an index.shtml file for that album. The index.shtml files all contain one or more SSIs. When I edit the index.shtml files, I want Apache to serve them to my browser and parse the SSIs.

I have spent hours pouring over http://httpd.apache.org/docs/2.4/ and I've puzzled over your replies, but I still don't get it. Please tell me what I'm doing wrong.

Thank you,

Dee
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7294
Location: Germany, Next to Hamburg

PostPosted: Thu 02 Jul '20 21:17    Post subject: Reply with quote

Quote:
When I try http://127.0.0.1/index.shtml I get error: "You don't have permission to access this resource."


Code:

DocumentRoot "E:/Classiccars/Websites/Websites from c3ghz/Classicars Albums"


Okay, there must also be a <Directory ...> in the httpd.conf There you must have the same path as in your DocumentRoot

Example

Code:

AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

DocumentRoot "E:/Classiccars/Websites/Websites from c3ghz/Classicars Albums"

<Directory "E:/Classiccars/Websites/Websites from c3ghz/Classicars Albums">
      Options Includes FollowSymLinks
      AllowOverride All
      Require all granted
   </Directory>


And you if you haven't done it yet, make sure that mod_includes is loaded (no # in front of the line)

Code:
LoadModule include_module modules/mod_include.so


restart apache and open http://127.0.0.1/index.shtml
Back to top
Dee



Joined: 19 Jun 2020
Posts: 6
Location: USA, NYC

PostPosted: Thu 02 Jul '20 23:24    Post subject: Reply with quote

Quote:
Okay, there must also be a <Directory ...> in the httpd.conf There you must have the same path as in your DocumentRoot

Yes, I did already have my project directory in DocumentRoot.

Quote:
And you if you haven't done it yet, make sure that mod_includes is loaded (no # in front of the line)

That was already done.

I did, however, change AllowOverride from None to All.

Here is part of my httpd.conf file with comments and blank lines removed:
Code:
LoadModule include_module modules/mod_include.so
<IfModule unixd_module>
User daemon
Group daemon
</IfModule>
ServerAdmin admin@example.com
ServerName www.example.com:80
<Directory />
    AllowOverride none
    Require all denied
</Directory>
DocumentRoot "E:/Classiccars/Websites/Websites from c3ghz/Classicars Albums"
<Directory "E:/Classiccars/Websites/Websites from c3ghz/Classicars Albums">
     Options Includes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>


I'm wondered whether ServerAdmin and ServerName needs correction. If so, what are the appropriate values? I don't think I have a "registered DNS name". As an experiment, I used 47.17.11.247 in place of example.com and restarted Apache. This gave no joy so I removed my ip address and returned "example.com" to the two lines.

Code:
restart apache and open http://127.0.0.1/index.shtml


The good news is that index.shtml did render in the Chrome browser. The bad news is that the SSIs did not parse which is understandable because Apache was not involved.

As another experiment, I renamed index.html in the project root directory and substituted a test file called index.shtml (note the "s" in the extension). Apache didn't render any file. Instead, it returned a directory listing of the project root directory.

JB, I appreciate your patience in replying with examples that make this arcane procedure a bit more understandable. Thank you.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7294
Location: Germany, Next to Hamburg

PostPosted: Fri 03 Jul '20 11:58    Post subject: Reply with quote

Do you have in your httpd.conf the following?

Code:

AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
Back to top
Dee



Joined: 19 Jun 2020
Posts: 6
Location: USA, NYC

PostPosted: Sat 04 Jul '20 14:04    Post subject: Reply with quote

Hi JB,

Quote:
Do you have in your httpd.conf the following?

Code:

AddType text/html .shtml
AddOutputFilter INCLUDES .shtml


Yes. I have those entries in httpd.conf exactly as you asked.

Upon further research, I found that it is necessary to install an extension to VS Code to make it work with Apache Felix. See:
https://developers.redhat.com/blog/2020/04/09/deploying-projects-to-apache-felix-tomcat-and-karaf-in-vs-code/. I may do that later but, for now, I am using the Notetab Pro editor which allows me direct access to Apache v2.4.

With this setup, the local Apache server is parsing SSIs exactly as done by the servers at the web host.

Thank you for all your help. I have a much better familiarization with the configuration of the local server.

This topic can be tagged "Solved".
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7294
Location: Germany, Next to Hamburg

PostPosted: Tue 07 Jul '20 12:18    Post subject: Reply with quote

Dee wrote:

Upon further research, I found that it is necessary to install an extension to VS Code to make it work with Apache Felix.


What has Apache Felix to do with this? That beyond me.
Back to top
Dee



Joined: 19 Jun 2020
Posts: 6
Location: USA, NYC

PostPosted: Fri 10 Jul '20 10:18    Post subject: Reply with quote

Quote:
What has Apache Felix to do with this?


The VC Code editor I'm using is designed to run with a large number of extensions. The extension that's specifically designed to interface with a live server capable of parsing SSIs uses Apache Felix.

Independently, I also use a second editor that now (with your help) works with Apache v2.4 and it too is parsing SSIs -- the original reason I sought help on this forum.

Thank you for your help,

Dee
Back to top


Reply to topic   Topic: SSIs not parsed by localhost:5501, SHTML files fail View previous topic :: View next topic
Post new topic   Forum Index -> Apache