Answer the question
In order to leave comments, you need to log in
Yii2 how to reach bakend using nginx?
I am using the following nginx config:
server {
set $yii_bootstrap "index.php";
charset utf-8;
client_max_body_size 128M;
listen 80; ## listen for ipv4
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
server_name test.site.ru;
root /var/www/site.ru/test/frontend/web;
index $yii_bootstrap;
access_log /var/www/site.ru/logs/test.site.access.log main;
error_log /var/www/site.ru/logs/test.site.error.log;
location /admin {
try_files $uri $uri/ /$yii_bootstrap?$args;
root /var/www/site.ru/test/backend/web;
}
location / {
try_files $uri $uri/ /$yii_bootstrap?$args;
}
# uncomment to avoid processing of calls to unexisting ystatic files by yii
#location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
# try_files $uri =404;
#}
#error_page 404 /404.html;
location ~ \.php$ {
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
}
location ~ /\.(ht|svn|git) {
deny all;
}
}
Answer the question
In order to leave comments, you need to log in
Hit the same wall! Did you end up solving the problem? =)
.....An hour later.... The problem was solved insanely simple and not through nginx... it was enough to disable caching of web pages in firebug and not puzzle over configs...
Here is the minimum working configuration:
server {
listen 80;
server_name example.ru;
root /home/example/data/www/example.ru;
index index.html index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$args;
}
location /admin {
try_files $uri $uri/ /admin.php?$args;
}
location ~ \.php$ {
root /home/example/data/www/example.ru;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/example/data/www/example.ru$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
I join the question, I tried in a similar way - it did not work.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question