开发者

apache alias vs symbolic link

开发者 https://www.devze.com 2023-03-17 11:15 出处:网络
When working with apache on a unix system, If your file system has icons in /home/me/web/icons and you want the browser be able to display them when calling the url http://www.me.com/icons/myicon.jp

When working with apache on a unix system,

If your file system has icons in /home/me/web/icons

and you want the browser be able to display them when calling the url http://www.me.com/icons/myicon.jpg for example,

then you have at least 2 solutions :

alias ( Alias /icons/ /home/web/icons/ )

symbolic links ( ln -s /home/web/icons /home/me/web/www/icons )

It seems to me that using apache aliases is the best choice since we know exactly that aliases would normally be in the /etc/apache2 directory ( so that is just one place to look at i开发者_如何学Pythonn case the application grows ), but I would be pleased to know about what solution you use and why ?


Using an Alias in your Apache httpd has several advantages over using a symbolic link:

  • Symbolic links require an additional disk access to resolve the symbolic link.
  • Alias works on all platforms supported by Apache httpd. Symbolic links are not supported by all platforms and filesystems.
  • Your Apache httpd configuration will work the exactly same way on a new system without the need to create symbolic links in your file system.


With shared hosting you are not authorized to alter the Apache config, so a symlink is an alternative.


Using an alias in the config file effectively documents your configuration. Using a link might well work but would not be an approach i would take.

On a productions machine I would use neither. Giving access to a user's directory would not be ideal from a security perspective. From the point of version control the icon directory should be filled like any other resource be it html or other form the QA'd release.

J

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号