#1  
Old 30th July 2012, 16:53
onastvar onastvar is offline
Senior Member
 
Join Date: Apr 2008
Location: U.S.A.
Posts: 188
Thanks: 59
Thanked 10 Times in 10 Posts
Default nginx rewrite

I'm using the following nginx Directives in my ISPConfig for one of my websites where I run WordPress and it works fine.

Code:
location / {
                try_files $uri $uri/ /index.php?$args;
           }

       # Add trailing slash to */wp-admin requests.
       rewrite /wp-admin$ $scheme://$host$uri/ permanent;

       location ~*  \.(jpg|jpeg|png|gif|css|js|ico)$ {
                expires max;
                log_not_found off;
       }
# Deny public access to wp-config.php
location ~* wp-config.php { 
    deny all; 
}
I'm trying to figure out how can I setup nginx rewrite so I can install another CMS (WordPress, Joomla, etc.) within same website, in another folder. Anyone has similar setup, please advise?
__________________
ISPConfig 3.0.5.4p1 | Debian Wheezy | BIND | Dovecot 1.2.15 | Apache 2.2.16 | MySQL 5.5 | PHP 5.4.4-14
Reply With Quote
Sponsored Links
  #2  
Old 31st July 2012, 18:25
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,735 Times in 2,571 Posts
 
Default

You can try nested locations for each folder, e.g. like this:

Code:
location / {
                try_files $uri $uri/ /index.php?$args;

               # Add trailing slash to */wp-admin requests.
               rewrite /wp-admin$ $scheme://$host$uri/ permanent;

               location ~*  \.(jpg|jpeg|png|gif|css|js|ico)$ {
                    expires max;
                    log_not_found off;
               }
               # Deny public access to wp-config.php
               location ~* wp-config.php { 
                    deny all; 
               }

}
Then try the same for a subfolder:

Code:
location /subfolder {
                try_files $uri $uri/ /index.php?$args;

               # Add trailing slash to */wp-admin requests.
               rewrite /wp-admin$ $scheme://$host$uri/ permanent;

               location ~*  \.(jpg|jpeg|png|gif|css|js|ico)$ {
                    expires max;
                    log_not_found off;
               }
               # Deny public access to wp-config.php
               location ~* wp-config.php { 
                    deny all; 
               }

}
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
nginx rewrite for drupal icphedia Installation/Configuration 6 24th November 2013 10:50
Major recovery Toucan Installation/Configuration 18 9th August 2011 11:45
A Working Nginx Catchall with ISPConfig 3. renders Tips/Tricks/Mods 4 15th April 2011 21:53
Nginx and PHP and Fastcgi Paladinemishakal Installation/Configuration 1 4th January 2011 13:45
How to change rewrite from apache to nginx vuit Server Operation 0 24th February 2010 07:45


All times are GMT +2. The time now is 05:09.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.