Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Trouble using soft link when requesting image file |
|
Author |
|
FloatingBee
Joined: 18 Feb 2018 Posts: 3
|
Posted: Mon 19 Feb '18 22:57 Post subject: Trouble using soft link when requesting image file |
|
|
Environment:
WHM v68.0.29
Apache/2.4.29
CENTOS 7.4
I am trying to configure Apache to follow a symbolic link from one account's public_html folder to another account's public_html folder. So, if Account1 has a soft link "slink":
~account1/public_html/slink -> ~account2/public_html
Given the above, assets are available via two paths:
account2.com/index.html is the same as
account1.com/slink/index.html
account2.com/st/site.css is the same as
account1.com/slink/st/site.css
I added the symlink, and things seemed to work, including html, css, and javascript files, files in subfolders, etc. The problem is, image files don't work. The log shows a 404 error when accessing via the soft link.
account2.com/image.jpg (200)
account1.com/slink/image.jpg (404)
The image files have the same permissions/owner/group as the text files.
I've searched for a solution but I haven't found any other example of someone with the same goal/problem. One thread said that Apache's memory-mapped files capability might cause symlink failures, and that using "EnableMMAP Off" might solve it. I do not have a lot of experience configuring Apache, so I am wary of adding that config option without more confidence it will solve the problem, and a better understanding of any performance implications.
Has anyone encountered this problem before? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7294 Location: Germany, Next to Hamburg
|
Posted: Wed 21 Feb '18 13:25 Post subject: |
|
|
Did you enable that "Feature"?
Code: | Options FollowSymLinks |
|
|
Back to top |
|
FloatingBee
Joined: 18 Feb 2018 Posts: 3
|
Posted: Wed 21 Feb '18 19:26 Post subject: |
|
|
James Blond wrote: | Did you enable that "Feature"?
Code: | Options FollowSymLinks |
|
Not explicitly, but I believe it was already enabled because html and other static files are working when fetched through the soft link.
Also, see my next reply. I found the issue. |
|
Back to top |
|
FloatingBee
Joined: 18 Feb 2018 Posts: 3
|
Posted: Wed 21 Feb '18 19:30 Post subject: |
|
|
I found the issue.
The soft link works. The issue was the Hotlink Protection module in cPanel. Account2 had Hotlink Protection enabled, and the valid domains did not include the domain used by Account1.
The soft links work for images if either (A) Hotlink Protection is disabled or (B) Hotlink Protection is enabled but the valid accounts include the Account1 domain. |
|
Back to top |
|
|
|
|
|
|