Answer the question
In order to leave comments, you need to log in
Correct nginx rewrite in subfolders with the same projects. How?
Help, I've been fighting for half a day, but so far nothing.
There is a main nginx host, and there are a bunch of folders in it, each of which has a copy of the project installed. The project requires a rewrite, for example test.domain.com/project1/login/ should work fine.
The current config is:
server {
listen 80 default_server;
server_name _;
server_name_in_redirect off;
root /usr/share/nginx/default;
}
server {
listen 80; ## listen for ipv4; this line is default and implied
root /usr/share/nginx/www;
index index.php index.html index.htm;
server_name test.domain.com;
location / {
try_files $uri $uri/ @handler;
expires 30d;
}
## These locations would be hidden by .htaccess normally
location ~* ^/.*/lib/ { deny all; }
location ~* ^/.*/cache/ { deny all; }
location /. {
return 404;
}
location @handler {
rewrite / /index.php;
}
location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
rewrite ^(.*.php)/ $1 last;
}
location ~* \.php$ {
if (!-e $request_filename) { rewrite / /index.php last; }
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/tmp/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Answer the question
In order to leave comments, you need to log in
Check if it gives 500 if test.domain.com/project1/login/index.php
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question