SSI configulations issues

tommys_project at yahoo.co.jp tommys_project at yahoo.co.jp
Sat Apr 17 04:40:26 UTC 2021


Hi,

I work on configuring for ssi on my environments but got errors like this once I check test.html with the following configulations:

Updated on: (none) [an error occurred while processing the directive]

Can you help me to fix the issues?


OS: Linux 4.9.0 Debian 9
nginx version: 1.14.1

------- test.html -------
<html>
  <head>
    <title>Sample SSI</title>
  </head>
  <body>
    Updated on:
    <!--#echo var="LAST_MODIFIED"-->
<!--#exec cmd="/bin/ls"-->
  </body>
</html>


------- /etc/nginx/nginx.conf -------
user  nginx nginx;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    server_tokens off;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;
    include /etc/nginx/sites-enabled/*;

    # Cloudflare IP address List for CDN
    set_real_ip_from 173.245.48.0/20;
    set_real_ip_from 103.21.244.0/22;
    set_real_ip_from 103.22.200.0/22;
    set_real_ip_from 103.31.4.0/22;
    set_real_ip_from 141.101.64.0/18;
    set_real_ip_from 108.162.192.0/18;
    set_real_ip_from 190.93.240.0/20;
    set_real_ip_from 188.114.96.0/20;
    set_real_ip_from 197.234.240.0/22;
    set_real_ip_from 198.41.128.0/17;
    set_real_ip_from 162.158.0.0/15;
    set_real_ip_from 104.16.0.0/12;
    set_real_ip_from 172.64.0.0/13;
    set_real_ip_from 131.0.72.0/22;
    set_real_ip_from 2400:cb00::/32;
    set_real_ip_from 2606:4700::/32;
    set_real_ip_from 2803:f800::/32;
    set_real_ip_from 2405:b500::/32;
    set_real_ip_from 2405:8100::/32;
    set_real_ip_from 2a06:98c0::/29;
    set_real_ip_from 2c0f:f248::/32;
    real_ip_header CF-Connecting-IP;

}


------- /etc/nginx/sites-available/default -------
server {
    listen       80;
    server_name  www.mydomain.com;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;
    access_log  /var/log/nginx/access.log;
    error_log   /var/log/nginx/error.log;

    location / {
        root   /var/www/html;
        ssi  on;
        ssi_last_modified on;
        index  index.php index.cgi index.html index.htm default.html default.htm;
    }
    location ~ ^/~(.+?)(/.*)?\.(php)$ {
        alias /home/$1/public_html$2.$3;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root;
        include        /etc/nginx/fastcgi_params;
    }

    location ~ ^/~(.+?)(/.*)?\.(pl|cgi)$ {
        alias /home/$1/public_html$2.$3;
        fastcgi_pass   127.0.0.1:8999;
        fastcgi_index  index.cgi;
        fastcgi_param  SCRIPT_FILENAME $document_root;
        include        /etc/nginx/fastcgi_params;
    }

    location ~ ^/~(.+?)(/.*)?$ {
        alias /home/$1/public_html$2;
        ssi  on;
        ssi_last_modified on;
        index  index.php index.cgi index.html index.htm default.html default.htm;
        autoindex on;
    }

    location ~ \.php$ {
        root           /var/www/html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        /etc/nginx/fastcgi_params;
    }

    location ~ \.pl|cgi$ {
        root           /var/www/html;
        fastcgi_pass   127.0.0.1:8999;
        fastcgi_index  index.cgi;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        /etc/nginx/fastcgi_params;
    }

    error_page  404              /404.html;
    location = /404.html {
        root /var/www/error_pages; internal;
    }

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /var/www/error_pages;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}
server {
    listen       80;
    server_name  mydomain.com;
    return 301 http://www.mydomain.com$request_uri;
}

server {
    listen       80;
    server_name  mail.mydomain.com;
    return 400;
}

server {
    listen       80;
    server_name  rdns.mydomain.com;
    return 400;
}

Regards,
Yusui



More information about the nginx mailing list