Eugeny / ajenti-v

Virtual Hosting addon for Ajenti
ajenti.org/#product-ajenti-v
MIT License
224 stars 80 forks source link

Custom config symlink #255

Open wrrr opened 7 years ago

wrrr commented 7 years ago

Looking for assistance, related somewhat to what @noogen helped with on another topic.

How to hard code a symlink (in custom config of Ajenti -v "Advanced tab) as an included server block to fetch assets from my cdn.domain.com /wp-content and /wp-includes directories. I understand how to symlink in the cli but want to learn how in a custom config for a single site. I have done what's necessary for upload paths and such for wp db images.

OR, how pull requests might work and be implemented as an alternative that would be so great but a grey area to me .

I have done a lot of due diligence research before posting this thread and contribute when I can my own assistance to others. I'm just stumped in how to do some things...

Thanks

noogen commented 7 years ago

I'm not exactly sure what you want from your question. Example of what you want to do may help?

I'm guessing it's something to do with rewriting of URL. I'm assuming that you want to serve your content off a CDN and your site will be the origin, then you probably want you use a plugin called WP Super Cache.

Most CDN works the same way. You point the CDN to your site as origin, then you use WP Super Cache to rewrite your local URL to your CDN URL.

Or maybe you want to ask question about how to setup rewrite / reverse proxy?

wrrr commented 7 years ago

Thanks for your comment @noogen I really appreciate that. I have been where you point to and just a follow up to maybe clarify what the objective is.

I've read (and worked) for hours in fact using plugins on the site in question and have a (self hosted) cdn working pretty well (without WP Super Cache).

So, I'm confused between rewriting and physical files... I have set up folders in my subdomain where images get uploaded/saved. I have also used several plugins to assist in using the cdn for css and js. I don't think the use of extra plugins is as elegant, and could be streamlined by telling the wp-config file to physcially use the /wp-content and /wp-includes from the cdn and update those folders/files as I work. Unfortunately, the guides I have read to do that consistently break my set up.

I don't expect a ton of help as I always force myself to learn by test test test... but I think there's also the possibility of a "gotcha" moment that I either come to myself or someone else knocks me upside the head with a profound statement....

You can see how it loads on Webpagetest.org here

plugins - cdn enabler, WP CDN Rewrite, jsDelivr, Autoptimize

Thanks again Tom.

noogen commented 7 years ago

1) Most CDN works best with static files (css, js, images, etc...). You should not include any php as there would be negative effect. This mean you should not be doing any kind of weird CDN reference of wp-includes. The benefit of CDN is that it take the traffic off your site and fully utilize the client fast connection for simultaneous downloads. If your site is fast enough or too slow, CDN will not have that much impact. http://adamyamada.com/maxcdn-review-improve-site-speed/ https://blog.kissmetrics.com/ecommerce-load-time-hazards/

2) If you're running multiple sites and want to share code folder. I would not recommend this. The headache of maintaining all different configuration matching different code base is worse than just having them as duplicates. It's better for you to have different code or even run in WordPress multi-site mode.

3) if you're looking for nginx proxy config. This is how you would create your own CDN. Example: https://gist.github.com/noogen/2374a03d2faf6130f937ba774972a083 I would recommend more reading on nginx.

4) If you're looking for location rewrite: http://blog.pixelastic.com/2013/09/27/understanding-nginx-location-blocks-rewrite-rules/ I would recommend StackPath (formerly MaxCDN). You can use their (EdgeRules™) to do the same thing. StackPath use NGINX in the backend for their CDN and provide a user friendly frontend to help you with NGINX configuration.

As for sharing wp-content, you are better off just referencing the static content files directly from the CDN.

wrrr commented 7 years ago

All that makes good sense thanks Tom. I appreciate the reading links.

The plugin CDN Enabler was the one that has a default of using the /wp-includes folder along with /wp-content. I believe that set up is designed more for KeyCDN account holders since they authored it.