Location configuration problem of openresty A problem caused by rewrite_by_lua

nginx.conf has a configuration like this

    location / {
        default_type "application/json;charset=utf-8";
        -sharp here must be use rewrite_by_lua instead of content_by_lua
        rewrite_by_lua "
            -sharp  url
        "
        proxy_pass_header Server;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://192.168.1.101:8012/;
    }
    

among them, the rewrite operation is done in rewrite_by_lua according to the rules of url.
now you want to add the location, of a web site as follows

    location = ~^/admin {
        root   html;
        index  index.html index.htm;
    }
    

normally, if you don"t have the location, root loation / of the above rewrite, it will point to the following html page
, but I thought the location of this / admin would take effect. After all, location follows lazy loading. It didn"t actually work.
I don"t know why?

Mar.21,2021

location = ~ ^ / admin what is the syntax? If there is either an exact match or a regular match, how can it be used together? I guess you want to use location / admin .

document: https://nginx.org/en/docs/htt.


it is easy to make mistakes when writing location, late at night. The correct thing is this

location /admin {
    root   html;
    index  index.html index.htm;
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b384cd-2c0f7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b384cd-2c0f7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?