域如何访问子域数据?

I have a CMS for my website which is hosted on the subdomain (admin.example.com). Both are in a different directory on the server. On the subdomain I upload all my files (mostly images) that are later to use on the main domain (example.com).

From the subdomain I upload file information to the database which is also used by the main domain, file_url, file_id etc. etc.

The thing is, how can I get hold of this information from my main domain? The file_urls currently look like ../folder/image.png and I don't want people, using the main domain, knowing that I have a subdomain which holds the CMS.

I was thinking about throwing everything on the main domain and restrict the admin area for default users. But what are your thoughts about this? is this safe? is there somehow a work-around?

UPDATE
Within a page from the subdomain.example.com I call this piece of code

$dir = "/usr/share/nginx/html/example.com/public_html/images/thumbnail";
    try {
        // Creating directory
        mkdir($dir, 0755, true);

    } catch(ErrorException $ex){
            //  Failure
        die($warnings[] =  "Error: " . $ex->getMessage());
    }
    exit();

This works, folders have 755 and files 644. It may be a dirty workaround but I am not aware of the consequences this may have. Please let me know!

You can point to the sub domain but it will be tricky ti hide the fact May I suggest you set the permissions for your sub domain to just execute for the public Eg Owner: read write execute Group: read, execute Everyone else, execute

This way they can use your site but cannot read the sub folder

Or set up a redirect header in your index.php file of your sub folder and direct them to the appropriate page

To clarify my answer update, I approach the folder of the wanted domain like

$dir = "/usr/share/nginx/html/example.com/public_html/images/..";

or this

$dir = "/usr/share/nginx/html/subdomain.example.com/public_html/..";

depending on what domain I want to manipulate data from.