• 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

Question Help access subdomain images from primary domain

SkyB

New Pleskian
Server operating system version
Ubuntu Linux Server 20.04
Plesk version and microupdate number
Obsidian 18.0.51
Hi,
New to Plesk. Can you please help me access subdomain image folder?
I have a website in httpdocs. I have a subdomain at the same directory level as httpdocs.
I cannot access urls for images between the 2 folders.

Domain:
/var/www/vhosts/PrimaryDomain.com/httpdocs/
/var/www/vhosts/SubDomain.com/

I've tried:
  1. changing the director in my php file. -> always remains on the current domain.
  2. set open_basedir = none -> has no effect.
  3. set open_basedir = {WEBSPACEROOT}{/}{:}{TMP}{/}:/SubDomain.com/
  4. using "/var/www/vhosts/SubDomain.com/" in my url -> always remains on the current domain.
  5. restarting the server.
My end goal is to have the PrimaryDomain webpage access images in the SubDomain directory and display them on the PrimaryDomain webpage.
I've tried creating a 'photos' folder on the Home Directory and uploading the files to that folder (from the SubDomain) and having the PrimaryDomain access them.
I can save to the folder but my urls to the image never get past the PrimaryDomain.com structure.

ie... index.html (httpdocs) = <img src = "../photos" /> reads "PrimaryDomain.com/photos/"
ie... index.html (httpdocs) = <img src = "/var/www/vhosts/photos/" /> reads "PrimaryDomain.com/photos/"
ie... index.html (httpdocs) = <img src = "/var/www/vhosts/SubDomain/" /> reads "PrimaryDomain.com/"

I CAN access php scripts in photos, though.

Any help allowing me to fix this issue would be greatly appreciated.
Thank you in advance,
Sky
 
I have a website in httpdocs. I have a subdomain at the same directory level as httpdocs.

Domain:
/var/www/vhosts/PrimaryDomain.com/httpdocs/
/var/www/vhosts/SubDomain.com/
This doesn't look right (but not impossible).

Some context: this directory /var/www/vhosts/example.com would be called the Home Directory of the domain example.com. The default Document Root is a directory called httpdocs that resides in the Home Directory (which would be /var/www/vhosts/example.com/httpdocs). If you create a subdomain called sub for example.com a directory wil be created named after the whole subdomain inside the Home Directory of the primairy domain (exmple.com) which functions as the Document Root of the subdomain. (So the full path to the Document Root for subdomain would be /var/www/vhosts/example.com/sub.example.com)

So there likely isn't a directory /var/www/vhosts/SubDomain.com/.

Hope this explanation helps.
 
Sorry, you're correct. SubDomain.com is sub.domain.com

My actual domains are Kwosen.com and mgt.kwosen.com.

mgt.kwosen.com uploads images to mgt.kwosen.com (I also am currently able to upload to a folder /var/www/vhosts/photos/ directory).
kwosen.com index.html displays those images (or that is the goal).

using "../mgt.kwosen.com/images/filename.jpg" does not work. url reads: https://www.kwosen.com/mgt.kwosen.com/images/filename.jpg

using "/var/www/vhosts/mgt.kwosen.com/images/filename.jpg" does not work. url reads: https://www.kwosen.com/var/www/vhosts/mgt.kwosen.com/images/filename.jpg"

I cannot seem to get past the "https://www.kwosen.com" portion to complete the path into any folder within the Home Directory.

When I try the "photos" folder in the home directory... the url path always reads https://www.kwosen.com/photos/filename.jpg".

Maybe this will help provide more information to help answer my question.
Thank you for responding. I feel like, I've tried everything but the thing that works, lol.
 
Back
Top