• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

A Simple Follow Symlinks / Apache Solution

D

digerati@

Guest
A Simple Symlink / Plesk / Apache Solution

We recently moved to Plesk servers from Ensim Servers and we love it. Plesk has come a long way since the last time we used it.

There was one particular issue I had problems finding help with, so I figured I would write a quick article up on the subject.

We have a number of application frameworks built in Adobe Coldfusion 8. In addition, many of our frameworks include FCKeditor, which requires symlinks in the web root for editor-based uploads. Now say a client has a website, extranet and 2 web portals; one for online customers and another for advertisers. The 'webwork' or collection of web applications, share a directory called 'DataVault', which contains all of their uploaded documents, user files, articles, etc. Basically anything uploaded across their 'webwork'.

When we were using Ensim, we simply symlinked the DataVault into each web directory. This became a problem with Plesk.

First I tried tinkering with the httpd.conf, psa conf and vhost.conf. I even tried hard linking. No luck. Many others seem to be having issues with Plesk allowing Apache to follow symlinks, especially to another subdomain path, outside of the web directory, or outside of the vhost directory.

After much frustration, I tried a simpler approach. I took the same approach as linking outside directories to Proftpd jailed home directories.

I simply created a mount point for the mount.

Do the following as root:

[root@localhost ~] vi /etc/fstab

Press 'i' to go into insert mode.

Add the following lines to your /etc/fstab file

Detailed Example:
/path/to/your/target/directory /path/to/your/shortcut/directory none bind 0 0

Real Example:
/var/www/vhosts/domain/DataVault /var/www/vhosts/domain/httpdocs/DataVault none bind 0 0

Press Esc Key to exit insert mode. Use 'wq' to write quit and save changes.

[root@localhost ~] mount -a
This command will mount all mount points you added to the /etc/fstab file.

Now that your additions were added to the /etc/fstab file, all of your mounts will be activated upon system boot.

There are a few issues with this method and maybe someone can provide some insight.

1.As I said earlier, a client could have several mounts to the DataVault directory. Plesk sees this as real disk space. For a 100GB size DataVault directory, linked 4 times, Plesk sees it as 500GB [ (4) 100GB mounts + 100GB physical copy = 500GB total ], but actually 100GB of disk space is being used in the domain's allocated space. This confuses clients in regards to actual space being used. Anyone know a way to exclude a paths or set of paths from Plesk reporting on disc usage and/or limits?

2. Plesk backups also pose a problem with the mounts. Again, is there a way to exclude paths? A 400GB nightly backup is heavy for 100GB of real data. I know I can exclude the DataVault directories manually with the tar command, but I'm not so sure in regards to Plesk as I'm relatively new to Plesk. I suppose I could have an cron job bash script tar up the files and exclude the DataVault paths, except for the physical copy of the DataVault.

Both of these two issues are minor consequences in my opinion.

I really hope this method helps people that are having problems with the symlinks and Plesk. This is a great fix with little sacrifice. Enjoy!

Rock.

:: digerati

- I will post a backup script example with path exclude options when I get time this week.
 
in domains /conf/vhost.conf file (create file if it doesnt exist)

So
Code:
/var/www/vhosts/domain.com/conf/vhost.com

add

PHP:
<Directory /var/www/vhosts/domain.com/httpdocs>
        Options FollowSymLinks
</Directory>

then run

Code:
/usr/local/psa/admin/bin/websrvmng -u --vhost-name=domain.com

In both instances replacing domain.com with valid domain names. Then the domain should be able to use symlinks for hosting.

You may also need SymLinksIfOwnerMatch to be off, but im not sure.
 
Hello,

I am trying to accomplish the exact opposite with symlinks.

That is, to have a symlink into the httpdocs directory of the subdomain, that will send into the httpdocs dir of the main domain, like :

http://subdomain.mydomain.com/mylink/ --> http://www.mydomain.com

And I do NOT want to use a url rewriting rule (that would kill my rating in search engines!)

Your tweaking in vhost.conf works like a charm, for symlink from the MAIN domain to the subdomain, but not the other way.

FYI, I have root access to the server, so nothing is out of reach.

(Those symlinks used to work when the website was on an Ensim Server, but it has now been moved to a Plesk.)

Can you suggest something?

Thanks in advance.

Regards,
frg62
 
Back
Top