关于域名配置。fecshop提供的方式是这样的。在store中配置store=>stores
'appserver.fecshoptest.com'=>[]
nginx配置大致如下:
server {
listen 80;
server_name appserver.fecshoptest.com;
root /usr/share/nginx/html/fecshop/appserver/web;
index index.php;
try_files $uri $uri/ /index.php$is_args$args;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9100;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
现在域名形式需要改成这样的:
www.fecshoptest.com/appsever
修改nginx中配置如下:
server {
listen 80;
server_name appserver.fecshoptest.com;
root /usr/share/nginx/html;
location ^~ /appserver {
try_files $uri $uri/ /appserver/web/index.php$is_args$args;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9100;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
然后将store配置修改为:
'www.fecshoptest.com'=>[],
'www.fecshoptest.com/appserver'=>[]
发现报错:
An Error occurred while handling another error:
exception 'ReflectionException' with message 'Method fecshop\services\Store::bootstrap() does not exist' in /usr/share/nginx/html/fecshop/vendor/yiisoft/yii2/web/ErrorHandler.php:195
Stack trace:
#0 /usr/share/nginx/html/fecshop/vendor/yiisoft/yii2/web/ErrorHandler.php(195): ReflectionMethod->__construct('fecshop\\service...', 'bootstrap')
#1 /usr/share/nginx/html/fecshop/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php(26): yii\web\ErrorHandler->addTypeLinks('fecshop\\service...')
#2 /usr/share/nginx/html/fecshop/vendor/yiisoft/yii2/base/View.php(330): require('/usr/share/ngin...')
#3 /usr/share/nginx/html/fecshop/vendor/yiisoft/yii2/base/View.php(250): yii\base\View->renderPhpFile('/usr/share/ngin...', Array)
#4 /usr/share/nginx/html/fecshop/vendor/yiisoft/yii2/web/ErrorHandler.php(249): yii\base\View->renderFile('@yii/views/erro...', Array, Object(yii\web\ErrorHandler))
#5 /usr/share/nginx/html/fecshop/vendor/yiisoft/yii2/web/ErrorHandler.php(304): yii\web\ErrorHandler->renderFile('@yii/views/erro...', Array)
#6 /usr/share/nginx/html/fecshop/vendor/yiisoft/yii2/web/ErrorHandler.php(326): yii\web\ErrorHandler->renderCallStackItem('/usr/share/ngin...', 23, 'fecshop\\service...', 'bootstrap', Array, 5)
#7 /usr/share/nginx/html/fecshop/vendor/yiisoft/yii2/views/errorHandler/exception.php(381): yii\web\ErrorHandler->renderCallStack(Object(yii\base\InvalidValueException))
#8 /usr/share/nginx/html/fecshop/vendor/yiisoft/yii2/base/View.php(330): require('/usr/share/ngin...')
#9 /usr/share/nginx/html/fecshop/vendor/yiisoft/yii2/base/View.php(250): yii\base\View->renderPhpFile('/usr/share/ngin...', Array)
#10 /usr/share/nginx/html/fecshop/vendor/yiisoft/yii2/web/ErrorHandler.php(249): yii\base\View->renderFile('@yii/views/erro...', Array, Object(yii\web\ErrorHandler))
#11 /usr/share/nginx/html/fecshop/vendor/yiisoft/yii2/web/ErrorHandler.php(116): yii\web\ErrorHandler->renderFile('@yii/views/erro...', Array)
#12 /usr/share/nginx/html/fecshop/vendor/yiisoft/yii2/base/ErrorHandler.php(111): yii\web\ErrorHandler->renderException(Object(yii\base\InvalidValueException))
#13 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\base\InvalidValueException))
#14 {main}
Previous exception:
exception 'yii\base\InvalidValueException' with message 'this domain is not config in store component' in /usr/share/nginx/html/fecshop/vendor/fancyecommerce/fecshop/services/Store.php:165
Stack trace:
#0 [internal function]: fecshop\services\Store->actionBootstrap(Object(yii\web\Application))
#1 /usr/share/nginx/html/fecshop/vendor/fancyecommerce/fecshop/services/Service.php(49): call_user_func_array(Array, Array)
#2 /usr/share/nginx/html/fecshop/vendor/fancyecommerce/fecshop/components/Store.php(23): fecshop\services\Service->__call('bootstrap', Array)
#3 /usr/share/nginx/html/fecshop/vendor/fancyecommerce/fecshop/components/Store.php(23): fecshop\services\Store->bootstrap(Object(yii\web\Application))
#4 /usr/share/nginx/html/fecshop/vendor/yiisoft/yii2/base/Application.php(320): fecshop\components\Store->bootstrap(Object(yii\web\Application))
#5 /usr/share/nginx/html/fecshop/vendor/yiisoft/yii2/web/Application.php(69): yii\base\Application->bootstrap()
#6 /usr/share/nginx/html/fecshop/vendor/yiisoft/yii2/base/Application.php(272): yii\web\Application->bootstrap()
#7 /usr/share/nginx/html/fecshop/vendor/yiisoft/yii2/base/Object.php(107): yii\base\Application->init()
#8 /usr/share/nginx/html/fecshop/vendor/yiisoft/yii2/base/Application.php(205): yii\base\Object->__construct(Array)
#9 /usr/share/nginx/html/fecshop/appserver/web/index.php(83): yii\base\Application->__construct(Array)
#10 {main}
有什么比较好的方式可以支持我所需要的配置方式:
域名/项目
如:xxx.com/appserver xxx.com/image xxx.com/appfront
。谢谢。