• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question symbolic link, not working

Stergios G

Basic Pleskian
Server operating system version
AlmaLinux 8.8
Plesk version and microupdate number
18.0.52
I have a WordPress site. I created a clone of this site on a subdomain (testing.domain.gr) and i tried to create a symbolic link, so the clone site can show images directory from "mother" site (/wp-content/uploads).

I used this command:
ln -s /var/www/vhosts/just4pets.gr/httpdocs/wp-content/uploads /var/www/vhosts/just4pets.gr/testing.just4pets.gr/wp-content/uploads
...and it seems to be created correctly, No problem appeared.

But when i tried to access in an url inside images on clone site (https://testing.just4pets.gr/wp-content/uploads/2024/07/all_animals_icons_64px.png), return error 404.
Any idea?
 
Hi,

Do you have "Restrict the ability to follow symbolic links" enabled in Apache & nginx Settings?
Is the symbolic link owned by the system user?
What do you have in the error log when you try to access the image?
 
Hi,

Do you have "Restrict the ability to follow symbolic links" enabled in Apache & nginx Settings?
Is the symbolic link owned by the system user?
What do you have in the error log when you try to access the image?
Hi adoraul and thnx for your reply.

Well yes "Restrict the ability to follow symbolic links" checkbox, it was checked, on main subscription and subdomain inside Apache & nginx Settings. I unchecked but the problem still remains.

Error logs:
on Subdomain "Apache SSL/TLS access" i have error code 400 for "all_animals_icons_64px.png"
1728295338403.png
on maindomain "Apache SSL/TLS access" i have error code 200 for "all_animals_icons_64px.png"
1728295289645.png
 
Hi,

Interesting. Anything in the error log when you access the URL that gives an HTTP 404?

Can you also provide the output of:
```
cd wp-content
ls -la
```
 
Do you have chroot active?
Might be better to use relative links ../../../httpdocs/wp-content/uploads
 
I
Hi,

Interesting. Anything in the error log when you access the URL that gives an HTTP 404?

Can you also provide the output of:
```
cd wp-content
ls -la
```
The folder upload is there:
wp-content]$ ls -la
total 200
drwxr-xr-x 16 just4petsgr psacln 4096 Oct 9 01:55 .
drwxr-x--- 10 just4petsgr psaserv 4096 Oct 9 01:55 ..
drwxr-xr-x 3 just4petsgr psacln 4096 Oct 4 13:08 cache
drwxr-xr-x 10 just4petsgr psacln 4096 Oct 4 13:08 fonts
drwxr-xr-x 3 just4petsgr psacln 4096 Oct 4 13:08 img
-rw-r--r-- 1 just4petsgr psacln 28 Oct 4 13:08 index.php
drwxr-xr-x 4 just4petsgr psacln 4096 Oct 5 08:57 languages
drwxr-xr-x 3 just4petsgr psacln 4096 Oct 4 13:08 maintenance
-rw-r--r-- 1 just4petsgr psacln 2541 Oct 4 13:08 maintenance.php
drwxr-xr-x 40 just4petsgr psacln 4096 Oct 9 01:55 plugins
-rw-r--r-- 1 just4petsgr psacln 9576 Oct 4 13:08 slider_back.webp
drwxr-xr-x 2 just4petsgr psacln 4096 Oct 4 13:08 smush-webp
-rw-r--r-- 1 just4petsgr psacln 115064 Oct 4 13:08 style.css
-rw-r--r-- 1 just4petsgr psacln 0 Oct 4 13:08 temp-write-test-63c7f3a66fa2f9-33806728
-rw-r--r-- 1 just4petsgr psacln 0 Oct 4 13:08 temp-write-test-63cb134299ca27-38835534
-rw-r--r-- 1 just4petsgr psacln 0 Oct 4 13:08 temp-write-test-63dd8a026762c7-43566429
-rw-r--r-- 1 just4petsgr psacln 0 Oct 4 13:08 temp-write-test-63e6c33876b921-24805617
-rw-r--r-- 1 just4petsgr psacln 0 Oct 4 13:08 temp-write-test-63e6c4925a46e3-21610651
-rw-r--r-- 1 just4petsgr psacln 0 Oct 4 13:08 temp-write-test-641e216146fc24-99555326
drwxr-xr-x 7 just4petsgr psacln 4096 Oct 9 01:55 themes
drwxr-xr-x 2 just4petsgr psacln 4096 Oct 7 14:59 upgrade
drwxr-xr-x 2 just4petsgr psacln 4096 Oct 4 13:08 upgrade-temp-backup
drwxr-xr-x 8 just4petsgr psacln 4096 Oct 8 11:34 uploads <--- is here
drwxr-xr-x 2 just4petsgr psacln 4096 Oct 4 13:08 webtoffee_export
drwx------ 2 just4petsgr psacln 4096 Oct 4 13:08 webtoffee_import
drwxr-xr-x 2 just4petsgr psacln 4096 Oct 9 10:22 wflogs
 
I think i found the problem but i don 't know if i can fix it.

The "uploads" folder, it is an important folder for wordpress. There are all images and media files for the cms. I have delete this folder from cloned website, and i used "symbolic link" to get the media files/folders from mother website.

BUT the cloned website is re-create the "uploads" folder, so cms prefers his own folder and not this from "symbolic link". So I don't think I'll ever be able to see the files from the parent site.
 
Hi,

Since both websites are in the same webspace/subscription, Nginx/Apache will have no problem accessing the folder.

Using WebSSH or SSH you can do the following:
Code:
cd testing.just4pets.gr/wp-content/
mv uploads/ uploads_;
ln -s ../../httpdocs/wp-content/uploads/ uploads

It will move the uploads folder out of the way and create the symbolic link right away.

Your ls output indicates uploads is a folder, not a link. It should start with l, not with d.

Another option is to proxy_pass the requests back to the live website. You can add the following in Additional Nginx Directives:

Code:
location ~ /wp-content/uploads/ {
    proxy_set_header          Host                              just4pets.gr;
    proxy_set_header          X-Forwarded-Host                  $host;
    proxy_set_header          X-Real-IP                         $remote_addr;
    proxy_set_header          X-Forwarded-For                   $proxy_add_x_forwarded_for;
    proxy_set_header          X-Forwarded-Proto                 $scheme;
    proxy_set_header          X-Forwarded-Port                  443;
    fastcgi_param             HTTPS                             on;
    proxy_redirect                                              off;
    proxy_next_upstream                                         error timeout invalid_header http_500 http_502 http_503 http_504;
    proxy_pass                                                  https://just4pets.gr:443$request_uri;

    client_max_body_size                                        100m;
    client_body_buffer_size                                     1m;
    proxy_connect_timeout                                       900;
    proxy_send_timeout                                          900;
    proxy_read_timeout                                          900;
    proxy_buffers                                               32 4k;
    proxy_ignore_headers                                        X-Accel-Expires Expires Cache-Control;

   # optional
    proxy_ssl_verify off;
}

With this approach it doesn't matter what you have in the uploads folder on testing.just4pets.gr. The requests are matched by Nginx and passed to the live website.
 
Back
Top