Sorry for the delay. It wasn't an error but the web pages were out of whack. Some of the files were now found.by martyparish - Nginx Mailing List - English
Unfortunately it did not. I was really hoping to do this with try_files instead of "if" and rewrite!by martyparish - Nginx Mailing List - English
actually this part was wrong; if (!-f $site_folder) { rewrite ^/[^/]+/(.*) /$1; } needs to be: if (!-d /etc/nginx/html/production/$site_folder) { rewrite ^/[^/]+/(.*) /$1; } * changed -f to -d ** had to add root path before $site_folderby martyparish - Nginx Mailing List - English
For anyone who comes across this scenario, here is how I got it working: # get the first folder name into a variable ($site_folder) map $uri $site_folder { ~^/(?P<folder>+)/.* $folder ; } ... server { ... if (!-f $site_folder) { rewrite ^/[^/]+/(.*) /$1; } } I am aware of the "if is evil" thing but it states that it is safe outsby martyparish - Nginx Mailing List - English
I will do that. I guess my main question is: can I use a variable in the location URI? location ^~ /$site_folder/ { It appears that the answer is no. I have confirmed the variable is set from the map block. However, when I use it in location like above, it gets skipped over. I appreciate the time you have spent with me!by martyparish - Nginx Mailing List - English
Okay, I finally got the mapped variable figured out! map $uri $site_folder { ~^/(?P<folder>+)/.* $folder ; } Now, I just need to figure out how to use it in the location block??? This is what I am trying: location ^~ /$site_folder/ { #rewrite ^/$site_folder/(.*) /$1; } Is it okay to use the named variable in the location like that? It's not picking iby martyparish - Nginx Mailing List - English
Thanks itpp2012 I was actually just experimenting with that approach! I was beginning to have a bit of success too! Not quite there yet though. map $uri $site_folder { #~^/(?P<folder>+)/.* $folder; ~^/(?P<folder>+)/.* $folder; } I saw an example very similar(or same) as what you gave me on a wordpress multi site page. I think my regex is a bit messed up but I wby martyparish - Nginx Mailing List - English
Thanks Francis! Sorry for not being clear enough. My code base is at: /etc/nginx/html/production/ The "site1, site2, etc..." folders do not exists at all. They are only seen and used in the public URLs. The original config I posted in the first post works, I just don't like it because there will be hundreds of "sitesX". It is using a location block with rewrite fby martyparish - Nginx Mailing List - English
I have been experimenting with this: location ^~ /+/ { rewrite ^/(.*)/(.*) /$2; } Of course I am getting 404 errors...by martyparish - Nginx Mailing List - English
Hello nginx gurus, First post but I have been reading this board for over a year! My scenario: I have many separate "sites" to run and they all use the same back end application(opencart). They also will be under the same domain, in folders. I don't want to duplicate the application code in each subdirectory. I've got it working with a few sites and it works well. However, Iby martyparish - Nginx Mailing List - English