nginx配置静态文件
时间: 2023-09-05 17:14:36 浏览: 122
nginx配置静态文件时,可以通过设置root指令来指定静态文件的存放路径。在配置中,可以使用location指令来定义访问静态文件的URL路径,并配合root指令指定文件存放的目录。例如,可以使用以下配置指定访问/images/路径下的静态文件:
location /images/ {
root /usr/local/nginx/html;
}
这样,当访问/images/路径下的文件时,nginx会在指定的root目录下查找对应的文件并返回给客户端。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [四、nginx静态文件的配置](https://blog.csdn.net/weixin_44929998/article/details/124234043)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [Nginx静态资源部署](https://blog.csdn.net/weixin_56644618/article/details/127708238)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]