1. 程式人生 > >Nginx靜態資源配置

Nginx靜態資源配置

Nginx配置靜態資源訪問,

在server節點中加入一個location節點配置即可,其它配置不變,如下:

location /file/ {
    alias /home/imgs/;
}

配置後,重啟Nginx,

即可通過 http://ip:port/file/a.jpg ,訪問 /home/imgs/a.jpg