Welcome! Log In Create A New Profile

Advanced

Yii2 *.conf for frontend, backend and api (!)

Posted by littlefuntik 
Yii2 *.conf for frontend, backend and api (!)
November 11, 2015 04:55AM
Frontend (/) work succesfully.
Backend (/admin) work succesfully.
Api (/api) returned 404.

My nginx configurations for host (Windows 7):

#
# Yii2 Advensed template configs
#
server {
listen 5000;
server_name localhost;
root html/gophp;

access_log off;
error_log logs/goshop.error.log;

charset utf-8;
client_max_body_size 100M;

location / {
root html/gophp/frontend/web;
try_files $uri /frontend/web/index.php?$args;
}

location ~* \.php$ {
try_files $uri /frontend/web$uri =404;
fastcgi_pass 127.0.0.1:9123;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

location ~* \.(htaccess|htpasswd|svn|git) {
deny all;
}

location /admin {
alias html/gophp/backend/web;
try_files $uri /backend/web/index.php?$args;

location ~* ^/admin/(.+\.php)$ {
try_files $uri /backend/web/$1?$args;
}
}

location /api {
alias html/gophp/api/web;
try_files $uri /api/web/index.php?$args;

location ~* ^/api/(.+\.php)$ {
try_files $uri /api/web/$1?$args;
}
}
}

Why /api is not working?
Help me, please...



Edited 1 time(s). Last edit at 11/11/2015 04:56AM by littlefuntik.
Re: Yii2 *.conf for frontend, backend and api (!)
November 11, 2015 05:04AM
If I modified
- location /api {
+ location /api2 {
Then uri "/api2" worked complete...



Edited 1 time(s). Last edit at 11/11/2015 05:05AM by littlefuntik.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 268
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