# channel-pub-api
127.0.0.1 channel-pub-api.localhost
127.0.0.1 www.channel-pub-api.localhost
return [
'components' => [
'request' => [
'baseUrl' => '',
'csrfParam' => '_csrf-frontend',
],
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
],
],
],
];
return [
'homeUrl' => '/backend',
'components' => [
'request' => [
'baseUrl' => '/backend',
'csrfParam' => '_csrf-backend',
'csrfCookie' => [
'httpOnly' => true,
'path' => '/backend',
],
],
'user' => [
'identityClass' => 'backend\models\User',
'enableAutoLogin' => true,
'identityCookie' => [
'name' => '_identity-backend',
'path' => '/backend',
'httpOnly' => true
],
],
'session' => [
// this is the name of the session cookie used for login on the backend
'name' => 'advanced-backend',
'cookieParams' => [
'path' => '/backend',
],
],
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
],
],
],
];
return [
'homeUrl' => '/api',
'components' => [
'request' => [
'baseUrl' => '/api',
'csrfParam' => '_csrf-api',
'parsers' => [
'application/json' => 'yii\web\JsonParser',
]
],
'urlManager' => require __DIR__ . '/urlManager.php',
],
];
return [
'class' => yii\web\UrlManager::class,
'enablePrettyUrl' => true,
'enableStrictParsing' => true,
'showScriptName' => false,
'rules' => [
],
];
User-agent: *
Disallow: /
User-agent: *
Disallow: /frontend/web
Disallow: /backend/web
Disallow: /api/web
## FRONTEND ##
server {
charset utf-8;
client_max_body_size 128M;
listen 80; ## listen for ipv4
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
server_name www.channel-pub-api.localhost;
root E:/wwwroot/channel-pub-api;
index index.php;
access_log logs/www.channel-pub-api.localhost.access.log;
error_log logs/www.channel-pub-api.localhost.error.log;
location / {
root E:/wwwroot/channel-pub-api/frontend/web;
try_files $uri $uri/ /frontend/web/index.php$is_args$args;
# omit static files logging, and if they don't exist, avoid processing by Yii (uncomment if necessary)
#location ~ ^/.+\.(css|js|ico|png|jpe?g|gif|svg|ttf|mp4|mov|swf|pdf|zip|rar)$ {
# log_not_found off;
# access_log off;
# try_files $uri =404;
#}
location ~ ^/assets/.+\.php(/|$) {
deny all;
}
}
location /backend {
alias E:/wwwroot/channel-pub-api/backend/web/;
# redirect to the URL without a trailing slash (uncomment if necessary)
#location = /backend/ {
# return 301 /backend;
#}
# prevent the directory redirect to the URL with a trailing slash
location = /backend {
# if your location is "/backend", try use "/backend/backend/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri /backend/backend/web/index.php$is_args$args;
}
# if your location is "/backend", try use "/backend/backend/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri $uri/ /backend/backend/web/index.php$is_args$args;
# omit static files logging, and if they don't exist, avoid processing by Yii (uncomment if necessary)
#location ~ ^/backend/.+\.(css|js|ico|png|jpe?g|gif|svg|ttf|mp4|mov|swf|pdf|zip|rar)$ {
# log_not_found off;
# access_log off;
# try_files $uri =404;
#}
location ~ ^/backend/assets/.+\.php(/|$) {
deny all;
}
}
location /api {
alias E:/wwwroot/channel-pub-api/api/web/;
# redirect to the URL without a trailing slash (uncomment if necessary)
#location = /api/ {
# return 301 /api;
#}
# prevent the directory redirect to the URL with a trailing slash
location = /api {
# if your location is "/api", try use "/api/api/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri /api/api/web/index.php$is_args$args;
}
# if your location is "/api", try use "/api/api/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri $uri/ /api/api/web/index.php$is_args$args;
# omit static files logging, and if they don't exist, avoid processing by Yii (uncomment if necessary)
#location ~ ^/api/.+\.(css|js|ico|png|jpe?g|gif|svg|ttf|mp4|mov|swf|pdf|zip|rar)$ {
# log_not_found off;
# access_log off;
# try_files $uri =404;
#}
location ~ ^/api/assets/.+\.php(/|$) {
deny all;
}
}
location ~ ^/.+\.php(/|$) {
rewrite (?!^/((frontend|backend|api)/web|backend|api))^ /frontend/web$uri break;
rewrite (?!^/backend/web)^/backend(/.+)$ /backend/web$1 break;
rewrite (?!^/api/web)^/api(/.+)$ /api/web$1 break;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
try_files $fastcgi_script_name =404;
}
location ~ /\. {
deny all;
}
}
## MISC ##
### WWW Redirect ###
server {
listen 80;
server_name channel-pub-api.localhost;
return 301 http://www.channel-pub-api.localhost$request_uri;
}









PHP / Laravel / Yii2 老项目维护与长期技术支持
如果你的 PHP / Laravel / Yii2 项目已经上线,但遇到原开发离职、Bug 长期无人修复、接口不稳定、性能下降、代码难以接手等问题,可以联系我做一次远程技术排查。
适合以下情况:
✅ 老旧 PHP 系统无人维护
✅ Laravel / Yii2 项目 Bug 修复
✅ 后台管理系统小功能迭代
✅ RESTful API 接口排查
✅ MySQL / Redis / Nginx 性能问题
✅ 长期远程兼职维护
可先从一次小问题开始:
✅ 线上报错排查
✅ 接口异常分析
✅ 慢查询与性能瓶颈定位
✅ 代码结构初步评估
✅ 部署环境与日志检查
如需咨询,请联系我,并注明:PHP 维护咨询。
联系方式:
Telegram:@shuijingwan
微信:13980074657
邮箱:shuijingwanwq@gmail.com

发表回复