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;
}
On Wed, Nov 23, 2011 at 08:27:55AM -0500, mennanov wrote:
Hi there,
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:
You have three top-level location{} blocks here.
You probably only want two.
location / {
This will match all requests that don’t match another location.
# rules for /cms/ queries only
location /cms/ {
This will match all requests that begin “/cms/”, unless they match
another location.
location ~ \.php$ {
This will match all requests that end in “.php”. Specifically including
both “/index.php” and “/cms/index.php”. Which is likely not what you
want.
In nginx, every request is handled by one location{} block.
Is there any way to use relative path in alias?
It does not look comfortable to write the whole absolute path, it would
be rather better if it is current root + path