1

我想要的是:

 / => /var/www/
 /measurements /var/meassurements

我使用“位置”得到什么:

 / => /var/www/
 /measurements => /var/measurements/measurements

我究竟做错了什么?

配置片段:

location / {                                                               
    # root   /usr/share/nginx/html;                                        
    root /var/www/;                                        
    index  index.html index.htm;                                           
}                                                                          

location /measurements {                                                         
    root   /var/measurements/;                                                
    autoindex on;                                                          
}     
4

1 回答 1

2

以下应该有效:

location / {                                                               
  # root   /usr/share/nginx/html;                                        
  root /var/www/;                                        
  index  index.html index.htm;                                           
}                                                                          

location /measurements/ {                                                         
  root   /var;                                                
  autoindex on;                                                          
}    

原因是路径是由 root + $uri 组成的,所以你最终要寻找/var/measurements/measurements

于 2012-11-19T15:10:27.687 回答