
I use NextGEN Gallery to ,anage images on my blog, but it is better to use separate domain for retrieving images. In this case browser use additional threats to load images and nginx can quick proceed images request.
I created new subdomain g.tigor.me specially for NextGen Gallery.
tigor.me and g.tigor.me should be on the same server.
WordPress filter
To enable images path rewriting paste this code to your theme in functions.php.
1 2 3 4 5 6 7 | function ngg_use_g($image,$imageID){ $image->thumbnailURL = str_replace('tigor.me/wp-content/gallery','g.tigor.me', $image->thumbnailURL); $image->imageURL = str_replace('tigor.me/wp-content/gallery','g.tigor.me', $image->imageURL); return $image; } add_filter('ngg_image_object','ngg_use_g', 10,2); |
Don’t forget to change tigor.me to your blog domain.
Nginx configuration
Now it’s time to add g.tigor.me to nginx.
1 2 3 4 5 | server { listen 80; server_name g.tigor.me; root /path-to-wordpress/wp-content/gallery/; } |
Понравилась статья? Посоветуйте друзьям!
| | Tweet |
Понравилась статья? Подпишись на рассылку по E-Mail или в RSS.


Русский


