Skip to content

Instantly share code, notes, and snippets.

@kenjiskywalker
Last active April 13, 2024 03:00
Show Gist options
  • Save kenjiskywalker/4596258 to your computer and use it in GitHub Desktop.
Save kenjiskywalker/4596258 to your computer and use it in GitHub Desktop.
nginxのtry_filesの動作の確認

nginx config

nginx.conf

server {
    listen 80;
    server_name example.com;
    root /var/www/html/;
    index index.html;
    access_log /var/log/nginx/access_log hogehoge;
    error_log  /var/log/nginx/error_log  error;
    
    try_files $uri $uri/ /hoge.html;
}

command line

$ cat hoge.html
hoge dayo
$
$ curl http://example.com/hogehogehogeeee
hoge dayo
$

access log

$ tail access_log
"GET /hogehogehogeeee HTTP/1.1" 200 10 "-" "curl ~
@usamino
Copy link

usamino commented Aug 6, 2020

わかりやすかったです。
ほんとに有難いです。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment