ling
ling

Reputation: 71

apache alias vs symbolic link

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 ?

Upvotes: 7

Views: 11599

Answers (3)

jin_hcc
jin_hcc

Reputation: 41

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

Upvotes: 4

joschi
joschi

Reputation: 13101

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.

Upvotes: 11

julianyoung
julianyoung

Reputation: 43

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

Upvotes: 1

Related Questions