Title: Nginx Setup for Multisite?
Last modified: February 3, 2021

---

# Nginx Setup for Multisite?

 *  Resolved [sclosson](https://wordpress.org/support/users/sclosson/)
 * (@sclosson)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/nginx-setup-for-multisite/)
 * Looking to install this plugin on a Multisite, but it’s running on Nginx instead
   of apache, so .htaccess rules won’t help here. How would I apply the same rules
   in nginx that you supply for .htaccess on a Multisite?
 * Thanks
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fnginx-setup-for-multisite%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [Mateusz Gbiorczyk](https://wordpress.org/support/users/mateuszgbiorczyk/)
 * (@mateuszgbiorczyk)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/nginx-setup-for-multisite/#post-13999195)
 * Hi [@sclosson](https://wordpress.org/support/users/sclosson/),
 * Thanks for your message.
 * The configuration for Nginx should also work for Multisite mode. Try them out
   and let us know if you’ve made it.
 *  Thread Starter [sclosson](https://wordpress.org/support/users/sclosson/)
 * (@sclosson)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/nginx-setup-for-multisite/#post-14004539)
 * Hey, thanks got it working, and just left it at via .htaccess in the Settings.
   Hope that isn’t a problem, converted all current images in the Media Library,
   haven’t uploaded any yet, but looking at the mime-types of the images, they are
   set to webp so I’m super excited and seems like the site is loading 5x faster
   now!
 * Had to add some filters here, hopefully just the dir paths need to be changed
   and not the url paths:
 *     ```
       add_filter('webpc_uploads_root', function($path) {
         return '/www/';
       });
   
       add_filter('webpc_dir_path', function($path, $directory) {
                      if ($directory !== 'webp') {
           return '/www/wp-content/uploads';
         }
         return '/www/wp-content/uploads-webpc';
       }, 10, 2);
       ```
   
 *  Plugin Author [Mateusz Gbiorczyk](https://wordpress.org/support/users/mateuszgbiorczyk/)
 * (@mateuszgbiorczyk)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/nginx-setup-for-multisite/#post-14004570)
 * I am happy to [@sclosson](https://wordpress.org/support/users/sclosson/)!
 * Use the following filters:
 *     ```
       add_filter( 'webpc_uploads_root', function( $path ) {
         return '/www/';
       } );
   
       add_filter( 'webpc_dir_path', function( $path, $directory ) {
         switch ($directory) {
           case 'uploads':
             return '/www/wp-content/uploads';
           case 'webp':
             return '/www/wp-content/uploads-webpc';
         }
         return $path;
       }, 10, 2 );
       ```
   
 * Filter `webpc_dir_path` can use different `$directory` values: `uploads`, `plugins`,`
   themes`, or `webp`.
 *  Thread Starter [sclosson](https://wordpress.org/support/users/sclosson/)
 * (@sclosson)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/nginx-setup-for-multisite/#post-14006191)
 * Wow, awesome. Thanks so much! You ROCK!
 *  [jeferssons](https://wordpress.org/support/users/jeferssons/)
 * (@jeferssons)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/nginx-setup-for-multisite/#post-14092565)
 * In this case the path is symbolic or should I put the correct path that my wordpress
   is installed in?
 *  [Epiel](https://wordpress.org/support/users/epiel/)
 * (@epiel)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/nginx-setup-for-multisite/#post-14152098)
 * where I have to add the following filters
 *     ```
       add_filter( 'webpc_uploads_root', function( $path ) {
         return '/www/';
       } );
   
       add_filter( 'webpc_dir_path', function( $path, $directory ) {
         switch ($directory) {
           case 'uploads':
             return '/www/wp-content/uploads';
           case 'webp':
             return '/www/wp-content/uploads-webpc';
         }
         return $path;
       }, 10, 2 );
       ```
   

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Nginx Setup for Multisite?’ is closed to new replies.

 * ![](https://ps.w.org/webp-converter-for-media/assets/icon-256x256.png?rev=2636288)
 * [Converter for Media - Optimize images | Convert WebP & AVIF](https://wordpress.org/plugins/webp-converter-for-media/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/webp-converter-for-media/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/webp-converter-for-media/)
 * [Active Topics](https://wordpress.org/support/plugin/webp-converter-for-media/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/webp-converter-for-media/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/webp-converter-for-media/reviews/)

 * 6 replies
 * 4 participants
 * Last reply from: [Epiel](https://wordpress.org/support/users/epiel/)
 * Last activity: [5 years, 3 months ago](https://wordpress.org/support/topic/nginx-setup-for-multisite/#post-14152098)
 * Status: resolved