Is it possible to use symbolic links from a site webspace to other directories on server?

Created:

2016-11-16 12:51:00 UTC

Modified:

2017-04-24 11:13:44 UTC

2

Was this article helpful?


Have more questions?

Submit a request

Is it possible to use symbolic links from a site webspace to other directories on server?

Applicable to:

  • Plesk for Linux

Question

Is it possible to use symbolic links from a site webspace to other directories on server?

Answer

By default, Apache does not follow symbolic links for security reasons, and Access Forbidden error is returned when trying to access the link. This behavior is controlled by the FollowSymLinks option.

Following symlinks can be enabled for the whole server in the main Apache configuration file:

    Options +FollowSymLinks

Alternatively, it can be set on a per-domain basis by placing it into the vhost.conf file.

For example:

To enable symlinks for a domain, go to Subscriptions > example.com > Web Server Settings > Additional directives for HTTP

with the content:

<Directory /var/www/vhosts/example.com/httpdocs>
Options +ExecCGI +FollowSymlinks
</Directory>

For old Plesk versions (less than Plesk 11.5) procedure is the following:

  1. Create custom configuration file /var/www/vhosts/examople.com/conf/vhost.conf with the content:

    <Directory /var/www/vhosts/example.com/httpdocs> 
    Options -Includes +ExecCGI +FollowSymlinks
    </Directory>
  2. Change group owner to apache

    chown root:apache /var/www/vhosts/example.com/conf/vhost.conf
  3. Reconfigure domain

    /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain example.com

Note: suexec does not follow symlinks; if you access a CGI script through a symbolic link, it will not work.

Have more questions? Submit a request
Please sign in to leave a comment.