Contents...
SSI (Server Side Include) is server side interpreted scripts language that is include a file into web page Recently I faced on issue with shtml file. Include was not working in shtml file. Developer was unable to find the reason that’s why he ask me to fix and resolve this issue. After doing some effort I found that SSI was not enabled on server side.
What is SSI (Server Side Include ) ?
Server Side Include is server side interpreted scripts language. It mostly used in web. Use of SSI is to include a file into web page.
It looks like this :
#vim index.shtml <!--/header-part--> <!--#include file="header.shtml"-->
Enabling SSI In Nginx :
To enable SSI you will need to edit your nginx.conf and file and “ssi on ” in server side location.
#vim /etc/nginx/conf.d/example.conf server { client_max_body_size 2M; listen 80; server_name www.example.com; ........... location /school/inter/ { root /var/www/web1/web; index index.php index.html index.htm index.shtml; ssi on; access_log /var/log/nginx/access.log upstream; error_log /var/log/nginx/error.log crit; ............. }
Here I have only enable SSI for /school/inter/ location. You can also enable for whole server put it in ” / ” location like below.
location / { root /var/www/web1/web; index index.html index.php index.shtml; ssi on; }
Save file and exit.
Now you will need to restart/reload nginx.
#service nginx reload/restart
Enabling SSI in apache :
To enable SSI in Apache you can use .httaccess file in Apache root directory. We can also edit httpd.conf file.
You can enable SSI for multiple file extension.
#vim /var/www/web1/web/.htaccess
RewriteEngine On AddHandler server-parsed .html AddHandler server-parsed .shtml AddHandler server-parsed .htm
Save and exit.
Thanks:)
If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.
How to logging any request to ssi location ? In my end, there is no data appears in my file. Below is my ssi location:
location ~* ^/ssi/gossinc/(.*)$ {
internal;
proxy_method GET;
proxy_set_body “”;
proxy_pass http://lite-dev/$1$is_args$args;
proxy_connect_timeout 3s;
proxy_read_timeout 3s;
}
Thanks! That worked for me for nginx 🙂