O'Reilly logo

Nginx 1 Web Server Implementation Cookbook by Dipankar Sarkar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using dynamic SSI for simple sites

With the advent of modern feature-full web servers, most of them have Server-Side Includes (SSI) built in. Nginx provides easy SSI support which can let you do pretty much all basic web stuff.

How to do it...

Let's take a simple example and start understanding what one can achieve with it.

  1. Add the following code to the nginx.conf file:
    server {
    …..
    location / {
    ssi on;
    root /var/www/www.example1.com;
    }
    }
    
  2. Add the following code to the index.html file:
    <html>
    <body>
    <!--# block name="header_default" -->
    the header testing
    <!--# endblock -->
    <!--# include file="header.html" stub="header_default" →
    <!--# echo var="name" default="no" -->
    <!--# include file="footer.html"-->
    </body>
    </html>
    
  3. Add the following code to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required