Hello, friends. In this post, you will learn how to enable the SSI module on Nginx. The process is easier than you might think, but it is convenient to know it to avoid headaches in the future.
What is SSI module?
Server-side includes (SSI) are a mechanism for employing the web server to perform tasks like displaying files as part of other files or displaying information like the URL of web pages or dates and times dynamically. (More info)
In short, it is a server side interpreted scripting language. Of course, it is more web oriented, although it can also have other uses.
SSI allows you to add dynamically generated content to web pages, without having to program the whole page using CGI, ASP, PHP or similar technology.
Now that you have a reference on what it is, you can enable its module in Nginx.
How to enable the SSI module on Nginx
In the case of Debian family distributions, the most common is to install Nginx with the following command
sudo apt install nginx
However, especially on Ubuntu, this standard Nginx installation does not include many modules that you may need in the future.
So, the solution is, simply install the nginx-full
package
sudo apt install nginx-full
If you already have a previous installation of Nginx, your configuration should not be affected, however make sure you take a backup of /etc/nginx
before executing the change and switch.
Now, when you check the Nginx version, you will notice that the SSI module is present.
nginx -V
Remember that the Nginx people themselves say that “Currently, the list of supported SSI commands is incomplete.” So be careful when using it.
Finally, you will have to introduce some changes to the configuration files for the sites.
They have to be placed inside the server
directive and furthermore inside location
the change is simply ssi on
.
For example:
location / {
root /var/www/mysite/;
index index.html index.php index.shtml;
ssi on;
}
Restarting the Nginx service will apply the changes.
Conclusion
The SSI module in Nginx can be very useful and necessary for many current sysadmins. So now you know how to use and enable it.