你这样做好像有点问题的,我已经验证过了。看错误日志也知道是在找/var/www/html/foo这个文件找不到。但燕十八讲课的时候是访问了/var/www/html/index.html这个文件,我想明白为什么出现这种情况。谢谢在 2017年1月18日星期三 UTC+8上午10:05:08,Hadals Yang写道:/var/www/html/foo/index.html在 2017年1月18日星期三 UTC+8上午9:33:51,maxwa...@gmail.com写道:location / { root html; index index.html index.htm; } location /foo { root /var/www/html; index index.html;}请教大家一个问题,这是我学习燕十八的nginx课程的一个学习案例,在/var/www/html/目录下存在一个index.html现在访问curl 'http://localhost/foo' 会匹配到/foo这个location(最长匹配规则),然后查看错误日志是 "/var/www/html/foo" failed (2: No such file or directory)而燕十八讲课的时候,的确是访问了/var/www/html/index.html页面了。测试了好久,不知道是为什么?有哪位高手指点下迷津。谢谢 --
/var/www/html/foo/index.html在 2017年1月18日星期三 UTC+8上午9:33:51,maxwa...@gmail.com写道:location / { root html; index index.html index.htm; } location /foo { root /var/www/html; index index.html;}请教大家一个问题,这是我学习燕十八的nginx课程的一个学习案例,在/var/www/html/目录下存在一个index.html现在访问curl 'http://localhost/foo' 会匹配到/foo这个location(最长匹配规则),然后查看错误日志是 "/var/www/html/foo" failed (2: No such file or directory)而燕十八讲课的时候,的确是访问了/var/www/html/index.html页面了。测试了好久,不知道是为什么?有哪位高手指点下迷津。谢谢
location / { root html; index index.html index.htm; } location /foo { root /var/www/html; index index.html;}请教大家一个问题,这是我学习燕十八的nginx课程的一个学习案例,在/var/www/html/目录下存在一个index.html现在访问curl 'http://localhost/foo' 会匹配到/foo这个location(最长匹配规则),然后查看错误日志是 "/var/www/html/foo" failed (2: No such file or directory)而燕十八讲课的时候,的确是访问了/var/www/html/index.html页面了。测试了好久,不知道是为什么?有哪位高手指点下迷津。谢谢