Support » Plugin: WP Original Media Path » Subdomain Issue

  • Resolved Turkish Delight

    (@turkish-delight)


    First and foremost, I apologize for what is likely a simple error. I have tried a variety of methods to correct this and each has failed.

    I am using the most recent version of this plugin and WP 4.6.1. There are no custom themes and no additional plugins, everything is a vanilla install of WordPress and this module.

    I have a subdomain set up, “http://cdn.example.com”, and a path in public_html “/example-path/uploads”. Both directories have 755 permissions.

    Within the module settings, I have these fields:

    – Store uploads in this folder: /example-path/uploads/
    – Full URL path to files: http://cdn.example.com/example-path/uploads/

    When trying to upload a simple image, I receive this error: “Unable to create directory uploads/2016/11. Is its parent directory writable by the server?”

    I have also removed the “/” in the path settings, so it would read:

    – Store uploads in this folder: example-path/uploads
    – Full URL path to files: http://cdn.example.com/example-path/uploads

    In this case, I get a false positive for uploads. The media library shows that the image was successfully processed, however the 2016/11/ directories were not created and an image does not exist.

    I have tried quite a bit, but unfortunately I am having a lot of trouble with what seems to be a simple configuration. Any advice here is welcome. Thank you.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author RVOLA

    (@rvola)

    Hi @turkish-delight

    Everything is almost good.
    The second field should only be http://cdn.example.com because it already advanced in the example-path/uploads

    It has been necessary to example-path/uploads/ if the cdn pointing to the root public_html server

    So to summarize:

    1. field 1: example-path/uploads
    2. field 2: http://cdn.example.com
    • This reply was modified 3 years, 1 month ago by RVOLA.
    • This reply was modified 3 years, 1 month ago by RVOLA.

    I attempted this suggestion, and unfortunately it is not working. What seems to happen is “example-path/uploads/2016/11” directories are made on the local server, not the CDN host. I will reattempt a few options and post back to this thread, however if you have any thoughts as to what might be wrong, I appreciate any input. Thank you!

    Plugin Author RVOLA

    (@rvola)

    It is not retroactive. Tries to upload an image with the new settings

    I have attempted a few uploads with the new settings, and the files are being dropped still into the local server.

    Again I am very sorry to bother you with this, I expect that whatever the problem is it must be something simple.

    Plugin Author RVOLA

    (@rvola)

    Normally when you have a bad settings the database saves the URL of the image. You should try to right-click the image that is not displayed in the administration and look at the URL. Then look in the ftp or the image has been positioned. By deducing the two you will find out where the problem comes from

    Very interesting.

    In wp_posts, the “guid” of this image is http://cdn.example.com/2016/11/image01.jpg
    In the media library, the URL is the same as above.
    However, this image appears in the local FTP, not the CDN subdomain. The path for the image is “/example-path/uploads/2016/11/image01.jpg”

    The WP Media URL settings are as follows:

    field 1: example-path/uploads
    field 2: http://cdn.example.com

    Plugin Author RVOLA

    (@rvola)

    OK now set sub domain so that the pointing folder is: example-parh/uploads

    Okay I figured it out. There a few issues regarding the path and ownership that I ran into. What I did not mention (I didn’t think it was relevant) is that cdn.example.com and example.com are hosted in two different hosts. To better explain:

    example.com is host 1. This host has “exampleuser” as it’s account owner.
    cdn.example.com is host 2. This host has “cdnexampleuser” as it’s account owner.

    When I’m running the wordpress site under example.com, I’m uploading all of my images into cdn.example.com. That means that my “exampleuser” is trying to access the directory I set up for it on cdn.example.com, but “exampleuser” does not have any ownership over this directory.

    Step 1:

    To change ownership, I SSH’d (you may need to contact your hosting provider if SSH is not available) into the cdn.example.com account, accessed the “public_html” directory and ran the following command:

    chown -R exampleuser:exampleuser example-path/

    This means that any directory or file that is placed under the example-path directory (including the example-path directory itself) is now owned by “exampleuser”.

    Step 2:
    For the last step, the path is critical. You will find the full scripting path, not just the path from site root. In my fields I have:

    Store uploads in this folder: /home/cdnexampleuser/public_html/example-path/uploads
    Full URL path to files: http://cdn.example.com/example-path/uploads

    *****

    @rvola, thank you very much for your time. I greatly appreciate your assistance here and your plugin.

    Plugin Author RVOLA

    (@rvola)

    OK happy for you that you have found the solution. In the FAQ I had written: attention is not a true CDN

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Subdomain Issue’ is closed to new replies.