Answer the question
In order to leave comments, you need to log in
How to configure nginx to dynamically substitute the path to the folder after the domain?
Good afternoon. I'm trying to set up nginx for dynamic url substitution in file paths.
What I mean.
There is a demo.server.ru path.
I want nginx to look at demo.server.ru/$path requests
and send them to /var/www/apps/demo/$path
That's how I'm trying to do it, but stubbornly refuses to send it to the path.
server {
listen 80;
server_name demo.server.ru;
root /var/www/apps/demo/;
location ^(.*) {
set $path $1;
passenger_enabled on;
root /var/www/apps/demo/$path/current/public;
}
}
try_files $uri /var/www/apps/demo/$uri/current/public;
Answer the question
In order to leave comments, you need to log in
RESOLVED!
server {
listen 80;
server_name demo.server.ru;
root /var/www/apps/demo;
location ~ /?(.*)$ {
set $path $1;
alias /var/www/apps/demo/$path/current/public/;
passenger_enabled on;
}
}
config.relative_url_root = "/sitename"
config.action_controller.relative_url_root = "/sitename"
you can make demo.server.ru directory and useroot /var/www/apps/$host/$path/current/public;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question