Project

General

Profile

Issues with Server Side Includes

Added by mtnman almost 3 years ago

We have developed a product that uses a Beaglebone Black running Debian 8 and using Lighttpd as our webserver. It has worked very well for quite a while. We’re at the point where we want to update to Debian 10. We have built a new unit using Debian 10, installed lighttpd, but are now having a problem with server side includes (SSI) with this configuration. Attached is a small screenshot of a webpage showing the issue.

As you can see, rather than showing the result of executing the command, it’s showing the actual command. This leads us to believe that server side includes are not working – not activated – within lighttpd.

We do include mod_ssi under server.modules in the lighttpd.conf file we’re using (the lighttpd.conf file is very similar to the one we used in the original Debian 8 installation that worked with no issues).

The full lighttpd.conf can be found here:
https://pastebin.com/BhFEfbzQ

On our original installation, we were on Debian 8.9 and Lighttpd 1.4.35. On the new install, we are using a Debian 10.3 IOT image (stripped down) with lighttpd 1.4.53. SSI just worked on the earlier installation and I never had to do anything special. The logs at /var/log/lighttpd don’t show any issues.

I’ve done lots of online reading but nothing I’ve tried so far has resolved the issue.

I’m hoping someone can show me what I’m doing wrong. Thanks for any help!


Replies (3)

RE: Issues with Server Side Includes - Added by gstrauss almost 3 years ago

For troubleshooting your config, see DebugVariables

If you are not sure if the request for .shtml is being handled by mod_ssi, then incrementally simplify your config until you are sure that .shtml is being handled by mod_ssi.
Make sure to restart lighttpd between config changes and testing.

I took a quick look through the config you posted and nothing immediately jumps out. However, you posted only the top-level config, not the includes. See the difference with lighttpd -f /etc/lighttpd/lighttpd.conf -p with the -p to print the config.

Does the request get processed by mod_ssi if you make an explicit request to http://example.com/index.shtml ?

.

(as posted in #3082)
BTW, if you are (finally) migrating from lighttpd 1.4.35 -- which is over 7 years old and has known security issues which are not patched in ancient Debian releases -- please consider using lighttpd 1.4.59 which is available in buster-backports for Debian 10

RE: Issues with Server Side Includes - Added by mtnman almost 3 years ago

Thanks, gstrauss, so much for your response and attention. My apologies for the delay in responding - I'm not a software engineer and I'm slow and was delayed due to the Memorial Day holiday. Here are responses to your questions and points.

First, I took the lighttpd.conf file and stripped it down - I kept removing lines until something changed.

After each change, I restarted lighttpd by doing:
sudo /etc/init.d/lighttpd restart

If there were any errors or lighttpd wouldn't start, I would run:
lighttpd -f /etc/lighttpd/lighttpd.conf -tt
and correct the errors before proceeding.

After doing that, here is the fully stripped down version (I left in one commented line to discuss further): ***
server.modules = (
     "mod_ssi",
)

server.document-root        = "/var/www" 
server.username             = "www-data" 
server.groupname            = "www-data" 
server.port                     = 80

index-file.names            = ("index.shtml")
ssi.extension               = (".shtml")
#ssi.exec                   = "enable" 

include_shell "/usr/share/lighttpd/create-mime.assign.pl" 
include "/etc/lighttpd/conf-enabled/*.conf" 

With this configuration, my "index.shtml" would load and it looked correct except for the places where the server side includes were not functioning. It looked the same as if the full original lighttpd.conf file were used.

If I commented out:
"mod_ssi" or
Index-file.names or
ssi.extension or
include_shell "usr/share/lighttpd/create-mime.assign.pl"
the page would still load but the formatting was broken. I'm not sure mod_ssi is being activated but commenting it out definitely changed the appearance of the displayed webpage.

Notice the lines ssi.extension and ssi.exec. There is a file called 10-ssi.conf located in /etc/lighttpd/conf-available that had the "ssi.extension" line in it. I had read in the lighttpd documentation that there was another configuration option for ssi called "ssi.exec" but that it was enabled by default. This file did not have that option listed in it but I tried putting it in lighttpd.conf anyway, just to see if made any difference - it didn't.

Notice the line "include "etc/lighttpd/conf-enabled/*.conf" ". There are no files under the directory /etc/lighttpd/conf-enabled. I had read in another post about creating a symbolic link from a file under conf-available to conf-enabled. I tried that and it didn't work either (assuming I got the symbolic link created correctly). For grins, I just copied over 10-ssi.conf from conf-available to conf-enabled. I got an error message that you can't activate a module twice and to correct my configuration. So, I backed that out.

I found another post where the poster said to enable server modules using "lighty-enable-mod xxx". In the directory /usr/sbin, there are several files including lighttpd-disable-mod and lighty-disable-mod. When I run either of these, it shows all the server modules being disabled and none enabled. I ran the above command to enable ssi and now these routines show that ssi is enabled. However, it made no difference in the web page's display.

I also ran your recommended command:
lighttpd -f /etc/lighttpd/lighttpd.conf -p
I didn't see anything obvious but I'm not sure what I should be looking for. Here is a link to the output of this command:
https://pastebin.com/7pdsxVds

line 678 would appear to indicate that mod_ssi is active? Also, does it confirm that ssi.exec is enabled? One thing I was suprised about is that this result did not show ssi.extension listed in the configuration.

At this point, what are the next steps I should take to troubleshoot this? I do intend to go back and read through the full lighttpd documentation again as I'm worried that many of the posts I'm seeing online might be outdated and I've creating my problem by following their instructions rather than the latest documentation. But, I've read through the documentation once and didn't see anything obvious.

Does the above information provide any more hints as to what might be causing my issue? What other information can I provide?

Thanks so much!

RE: Issues with Server Side Includes - Added by gstrauss almost 3 years ago

server.modules needs to include "mod_ssi" for mod_ssi to be loaded, and then you need to configure mod_ssi with ssi.extension = (".shtml") for mod_ssi to handle requests with url-paths ending in ".shtml".

If lighttpd -f /etc/lighttpd/lighttpd.conf -p did not show ssi.extension = (".shtml"), then lighttpd mod_ssi is not enabled in /etc/lighttpd/lighttpd.conf.

Your specific problem is likely that you do not know the command your scripts are using to start lighttpd, and that you are not editing the config file(s) that are being used by the script you are using to start lighttpd. An alternative is that you have commented things out and have been sloppy about what you test and what you cut-n-paste.

    (1-3/3)