apache alias vs symbolic link

拜拜、爱过 提交于 2019-12-04 11:38:45

问题


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 in case the application grows ), but I would be pleased to know about what solution you use and why ?


回答1:


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.



回答2:


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




回答3:


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



来源:https://stackoverflow.com/questions/6561441/apache-alias-vs-symbolic-link

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