就是前端在访问一些静态资源的时候,可以直接通过nginx去访问,不需要请求后端服务

    (1)在webapps文件夹中创建 /data/image/01.jpg /data/www/a.html
    (2)配置Nginx配置文件

    1. server{
    2. listen 80;
    3. server_name 192.168.17.129;
    4. location /image/ {
    5. root /data/;
    6. autoindex on;
    7. }
    8. location /www/ {
    9. root /html;
    10. index index.html index.htm;
    11. }
    12. }

    访问 192.168.17.129/image/01.jpg 显示图片
    访问 192.168.17.129/image/ 显示如下,因为配置了 autoindex
    Nginx 动静分离 - 图1