Nginx是一个HTTP的web服务器,可以将服务器上的静态文件(如HTML、图片等)通过HTTP协议返回给浏览器客户端。我们只要配置配置location就行了
listen 80;
server_name 112.74.110.26;
location /ace-master {
root /opt/static;
index index.html index.htm;
}
当我们访问112.74.110.26:80/ace-master的时候,会被nginx拦截,进行location匹配。
112.74.110.26:80就是根路径/,代表linux磁盘上的/opt/static目录。
所以112.74.110.26:80/ace-master就相当于访问/opt/static/static目录下的index.html页面。
**