Axiol
Axiol

Reputation: 5962

Include a log file in a HTML page with SSI

I'm trying some stuff for the moment and now it's trying to display the content of a log file in a HTML page.

So, I add ssi on; in my Nginx .conf file and add this to the HTML page :

<!--#include file="../../../../var/log/nginx/logs.access.log" -->

The path is good but I'm always having this error :

[an error occurred while processing the directive]

Would you have any idea ?

Upvotes: 0

Views: 1663

Answers (1)

VBart
VBart

Reputation: 15130

<!--#include file= in nginx is the same thing as <!--# include virtual=, so ../../../../var/log/nginx/logs.access.log doesn't look like valid request.

But you can add location like this:

location = /logs.access.log {
    internal;
    root /var/log/nginx;
}

and use <!--#include file="/logs.access.log" --> accordingly.

Upvotes: 1

Related Questions