Configuration 如何配置ngnix位置?

Configuration 如何配置ngnix位置?,configuration,nginx,location,Configuration,Nginx,Location,我想要的是: / => /var/www/ /measurements /var/meassurements 使用“位置”得到的信息: 我做错了什么 配置代码段: location / { # root /usr/share/nginx/html; root /

我想要的是:

 / => /var/www/
 /measurements /var/meassurements
使用“位置”得到的信息:

我做错了什么

配置代码段:

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

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

以下方面应起作用:

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

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

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