nginx alias+location directive

后端 未结 2 1383
挽巷
挽巷 2021-02-08 11:23
server {
    listen      80;
    server_name  pwta; 
    root html;

    location /test/{
        alias html/test/;
        autoindex on;
    }
    location ~ \\.php$ {
         


        
2条回答
  •  隐瞒了意图╮
    2021-02-08 12:20

    Both the alias and root directives are best used with absolute paths. You can use relative paths, but they are relative to the prefix config option used to compile nginx, and are generally not what you want.

    You can see this by executing nginx -V and finding the value following --prefix=.

    Prove this to yourself by looking at the log, you will find a "no such file" error.

提交回复
热议问题