LoginSignup
7
6

More than 5 years have passed since last update.

nginxでSSIを有効化する

Last updated at Posted at 2017-02-14

nginxの環境でServer Side Includesを使用する機会があったのでメモ

/etc/nginx/nginx.confを編集

location /内で下記の通りssiを有効化する

nginx.conf
http {
    server {
        location / {
                ssi  on;
                ssi_last_modified on;
        }
    }
}

nginxの再起動

$ sudo service nginx restart

テストとして.shtmlファイルを作成

公開ディレクトリに$ sudo vi test.shtmlでファイルを作成する

test.html
<!--#config timefmt="%A %B %d, %Y" -->
Today is <!--#echo var="DATE_LOCAL" -->

確認

http://IP_Adress/test.shtml にアクセスする
正しく設定されていれば、日付が表示されるはず

7
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6