摘要: 1、应用场景: 当存在多个域名时,如果所有配置都写在 nginx.conf 主配置文件中,难免会显得杂乱与臃肿。 为了方便配置文件的维护,所以需要进行拆分配置。 2、在 nginx 的 conf 目录下 创建 vhost 文件夹: [root@Centos conf]# pwd /usr/local 阅读全文
posted @ 2020-03-13 18:17 d0usr 阅读(29880) 评论(0) 推荐(3) 编辑
摘要: 1、alias 配置: location /resources/image/ { alias /local_path/image/; }# 访问:http://127.0.0.1/resources/image/test.png# 定位资源路径为:/local_path/image/test.png 阅读全文
posted @ 2020-03-13 17:04 d0usr 阅读(230) 评论(0) 推荐(0) 编辑
摘要: server { listen 80; server_name localhost; location /api1/ { proxy_pass http://localhost:8080; } # http://localhost/api1/xxx -> http://localhost:8080/ 阅读全文
posted @ 2020-03-13 16:33 d0usr 阅读(657) 评论(0) 推荐(0) 编辑