Nginx Location 及动静分离

家住魔仙堡 提交于 2019-11-29 18:23:06

一.Nginx Location

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 二.动静分离

动静分离就是将nginx需要处理的东西分开放置处理。(参考Nginx反向解析)

113中共享图片文件

[root@localhost ~]# mkdir /images
[root@localhost ~]# vim /etc/exports

[root@localhost ~]# cat /etc/exports
/images 192.168.200.111(ro)

[root@localhost ~]# systemctl restart rpcbind
[root@localhost ~]# systemctl restart nfs

[root@localhost images]# ls      //在images中上传测试图片
linux11.jpg

111中挂载目录

[root@localhost ~]# mkdir /usr/local/nginx/html/images
[root@localhost ~]# mount 192.168.200.113:/images /usr/local/nginx/html/images
[root@localhost ~]# cd /usr/local/nginx/html/images
[root@localhost images]# ls
linux11.jpg

在index.html中引用图片

用浏览器测试

 

测试成功

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!