WebFaction
Community site: login faq

I have trying a few things from googled and it didn’t work. How can I have subdomain serving uploads in WordPress?

Ex. http://static.example.com/wp-content/uploads/year/date/image.jpg

Thanks, Mikey3D

asked 23 Oct '16, 21:39

Mikey3D
16138
accept rate: 0%


The easiest would be to create a symbolic link app to your /home/<username>/webapps/<wordpress_app>/wp-content/uploads directory and then create a website that will link your static.example.com subdomain with the new app.

You will also need to update the value of the uploads_url_path raw in the wp_options table to http://static.example.com. You can do that either using the mysql command client over an ssh session or via phpMyAdmin.

You will then be able to access your files from a link like http://static.example.com/year/date/image.jpg

If you have any media in your library already, you will need to update their urls in the database directly, although they will still be accessible through the old path. Search for uploads in this page, for an example.

permanent link

answered 24 Oct '16, 10:45

iliasr ♦♦
2.2k14
accept rate: 34%

I get the same URLs result in two difference ways.

Firstly, I created WordPress app then what I did was to put the subdomain in upload_url_path by this link http://example.com/wp-admin/options.php then “Save Changes” button. After I created WP post with image and I get the image URL is http://static.example.com/2016/10/image-300x225.jpg.

Secondly, I created another WordPress app then I created a symbolic link app as @iliasr mention above here in every step I follow. Then after I created WP post with image and I get the image URL is http://static.example.com/2016/10/image-300x225.jpg

Which one is better way and better performance?

(27 Oct '16, 01:04) Mikey3D

I would suggest sticking to the recommendations Ilias made. It's a variation of what we recommend here:

https://docs.webfaction.com/software/wordpress/advanced.html?highlight=advanced#advanced-wordpress

There are other tips there that may assist you with performance if that is what you want.

(27 Oct '16, 02:02) NickR ♦♦

WordPress: Start from Scratch with Subdomain for Serving Uploads Faster

To improve performance for your WordPress application, create a subdomain and symbolic link application to serve your WordPress application’s media directly. To create and configuration, firstly, a subdomain and then secondly, the symbolic link application and then thirdly, add subdomain in your WordPress site:

Firstly, do this:

  1. Log in to the control panel.
  2. Click Domains / Websites > Domains. The list of domains appears.
  3. Click Add new domain.
  4. In the Domain names to add field, enter a subdomain - Ex. static.example.com
  5. Click the Save button. The domain is created.

Secondly, do this:

  1. Log in to the control panel.
  2. Click Domains / Websites > Applications. The list of applications appears.
  3. Click Add new application.
  4. In the Name field, enter a name for the application. Ex. wp_uploads.
  5. In the App category field, click to select Symbolic link.
  6. In the App type field, click to select Symbolic link to static-only app.
  7. In the Extra info field, enter /home/username/webapps/wordpress/wp-content/uploads/, where username is your username and wordpress is the name of the WordPress application.
  8. Click the Save button. The application is installed.
  9. Click Domains / Websites > Websites. The list of websites appears.
  10. Click Add new website.
  11. In the Name field, enter a name wp_uploads.
  12. In the Domains field, enter a subdomain, static.example.com.
  13. In the Contents field, click Add an application to select Reuse an existing application > Application: Select wp_uploads > Click the Save button.
  14. Click the Save button. The application is installed a new website.

Thirdly, do this:

  1. Log in your WordPress site then go to Ex. http://example.com/wp-admin/options.php.
  2. In the upload_url_path field, enter a subdomain http://static.example.com
  3. Click the “Save Change” button.


 

I have some questions.

  1. Do you agree that is how to create and setup subdomain for serving uploads?
  2. There are 6 symbolic link apps. Which symbolic link app should I choose for subdomain to serving uploads?
  • Symbolic link to static/cgi/php70 app
  • Symbolic link to static/cgi/php56 app
  • Symbolic link to static/cgi/php55 app
  • Symbolic link to static/cgi/php54 app
  • Symbolic link to static/cgi/php53 app
  • Symbolic link to static-only app

Thanks, Mikey3D

PS: This Webfaction “Serving Uploads Faster” doc is around 10 years old. The things have changed. It needs to be updates.

permanent link

answered 27 Oct '16, 17:58

Mikey3D
16138
accept rate: 0%

edited 27 Oct '16, 19:01

Do you agree that is how to create and setup subdomain for serving uploads?

Seems reasonable to me.

There are 6 symbolic link apps. Which symbolic link app should I choose for subdomain to serving uploads?

Symbolic link to static-only app

This Webfaction “Serving Uploads Faster” doc is around 10 years old. The things have changed. It needs to be updates.

All of the info presented there is still accurate. What do you think needs to be changed?

(27 Oct '16, 22:08) seanf

All of the info presented there is still accurate. What do you think needs to be changed?

It needs to add subdomain to serving uploads faster. There are the reasons why the YouTube is using subdomain s.ytimg.com and Yahoo is using subdomain s.yimg.com also. It will effectively parallel download speed.

(28 Oct '16, 01:41) Mikey3D

How do I know WordPress is using symbolic link files to serving uploads? I have testing everything in many ways and I don’t see it’s using symbolic link. How do I find out it really is?

(31 Oct '16, 14:06) Mikey3D

How do I know WordPress is using symbolic link files to serving uploads? I have testing everything in many ways and I don’t see it’s using symbolic link. How do I find out it really is?

If you check the Apache access logs for your site, eg logs/frontend/access_sitename_php.log you'll see that nothing from wp-content/uploads is being served be Apache.

(31 Oct '16, 18:23) seanf
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×245

question asked: 23 Oct '16, 21:39

question was seen: 1,810 times

last updated: 31 Oct '16, 18:23

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM