比如test.com访问到/home/www/index.php
一下是我的配置,一直不成功,刚刚接触服务器,希望大家指点一下
浏览器输入网址:www.abc.com/index.html
这个请求发到nginx之后,肯定就是访问一个对应的Linux上的某个文件夹下的名字叫做index.html的文件。
location / {
root html;
index index.html;
}
这个是什么意思呢?root是一个关键字,后面接一个路径,就是linux上的文件夹路径。
你如你访问 www.abc.com/index.html 发到nginx之后,被 location / 匹配到。
于是这个里面配置了 root html;nginx就去目录html下找,找index.html 于是访问本地磁盘 html/index.html
你如果配置成 root /home/www 也许访问的就是 /home/www/index.html。
index 这个关键字就是表示,如果你访问的路径没找到,就默认返回index.html, index.html没找到就返回index.htm
都是我猜的,你试试看对不对
你需要修改root对应到你的文件路径去匹配