Apache alias vs symlink

When working with apache on a unix system

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

and you want the browser to display them when calling 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 for sure that aliases will usually be located in the / etc / apache 2 directory (so this is just one place to view if the application is growing), but I would be happy to know What solution do you use and why?

+6
source share
3 answers

Using Alias in your Apache httpd has several advantages over using a symlink:

  • Symbolic links require additional disk access to eliminate symbolic links.
  • Alias runs on all platforms supported by Apache httpd. Symbolic links are not supported on all platforms and file systems.
  • Your Apache httpd configuration will work exactly the same on the new system without having to create symlinks in your file system.
+8
source

When using shared hosting, you do not have the right to change the configuration of Apache, so a symlink is an alternative.

+3
source

Using an alias in the configuration file effectively documents your configuration. Using a link may work well, but will not be the approach I would take.

On a production machine, I would not use either one or the other. Providing access to the user directory will not be ideal from a security point of view. From the point of version control, the icon catalog should be filled, like any other resource, be it html or another QA'd release form.

J

+1
source

Source: https://habr.com/ru/post/891898/


All Articles