nginx作为图片服务器
访问已在服务器上图片的方法
方法一 图片存放在nginx的静态页面目录
记住nginx/conf下的nginx.conf 而不是编译目录下conf/nginx.conf
添加
location /images/ { root html; index index.html index.htm; }
使得访问http://ip:port/images/访问的是 nginx/html目录
图片文件都放在html下面 直接 http://ip:port/images/图片名.jpg 就能访问了
方法二 使用别名映射到服务器某个文件夹路径
location /images/ { alias /usr/local/nginx/html/images/; autoindex on; }
这就是将http://ip:port/images/访问 转发到访问服务器/usr/local/nginx/html/images/这个文件路径
方法三 使用转发到后端url请求地址访问
location /uploadFile { proxy_pass http://ip:port/images/ }
转发请求到你已经部署好的服务器 调用你自己的java/php服务器的转发访问路径请求