November 23, 2011 08:27AM
Hello, i have a website with the following files structure:

engine/
__index.php
webroot/
__images/
__css/
__cms/
______engine/
_________index.php
______webroot/
_________images/
_________css/
others/

So the folder "cms" is placed in a webroot of the main site. The point is that all queries like "/js/jquery.js" must be treated as "/webroot/js/jquery.js" and all cms queries like "/cms/js/jquery.js" must be treated as "/webroot/cms/webroot/js/jquery.js". I spent 2 days writing a proper config, the main problem is that all queries to /cms/ location MUST NOT be parsed in "location / {...}" and all queries in "location /cms/ {...}" must not be parsed in "location / {...}"

Here is my config:

server {
listen 8080;
server_name glinka.fm;
root /home/renat/www/glinka;
index index.php index.html;

# rules for all queries except /cms/ (how to do that??) "location ~ /(?!cms)" makes a cycle and 500 error
location / {
try_files /webroot/$uri /engine/index.php;
}

# rules for /cms/ queries only
location /cms/ {
rewrite /cms/(.*) /webroot/cms/webroot/$1;
if (!-f $request_filename) {
rewrite (.*) /webroot/cms/engine/index.php;
}
}

location ~ \.php$ {
include fastcgi.conf;
}
}

Please help me
Subject Author Posted

Match any location except particular one

mennanov November 23, 2011 08:27AM

Re: Match any location except particular one

Francis Daly November 23, 2011 09:48AM

Re: Match any location except particular one

mennanov November 23, 2011 10:11AM

Re: Match any location except particular one

Igor Sysoev November 23, 2011 11:18AM

Re: Match any location except particular one

mennanov November 23, 2011 11:26AM

Re: Match any location except particular one

Igor Sysoev November 23, 2011 11:30AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 275
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready