Thursday, March 21, 2013
expose URL to access local files on server
Sometimes, we need to access local files on server via HTTP URL. If the files are under /webapp/<project>, take tomcat as an example, it is very east to access them via relative path. If the files are outside of tomcat or other web app servers, how to resolve it?
1) create soft link at /var/www/html/<your root context>
ln -s <file location on server> imgupload
2) modify apache setting
<Directory />
Options FollowSymlinks
Allow from all
</Directory>
refer to http://httpd.apache.org/docs/2.2/mod/core.html
3) then on web page
<img src="/imgupload/<subfolder if have>/abc.jpg" />
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment