Browse Source

Update php7.4

Update provision files
Disable installing ElasticSearch, SuperVisor and Redis
master
Error202 4 years ago
parent
commit
246c8bbdc9
  1. 9
      Vagrantfile
  2. 15
      api/codeception.yml
  3. 3
      api/config/.gitignore
  4. 1
      api/config/bootstrap.php
  5. 301
      api/config/main.php
  6. 4
      api/config/params.php
  7. 4
      api/config/test.php
  8. BIN
      api/web/favicon.ico
  9. 18
      api/web/index-test.php
  10. 25
      api/web/index.php
  11. 2
      common/config/bootstrap.php
  12. 10
      common/runtime/mail/20180211-204419-7974-3045.eml
  13. 10
      common/runtime/mail/20180211-204542-9675-3097.eml
  14. 10
      common/runtime/mail/20180211-204830-4001-4976.eml
  15. 10
      common/runtime/mail/20180211-204904-0101-1020.eml
  16. 12
      common/tests/_data/user.php
  17. 8
      environments/dev/common/config/params-local.php
  18. 2
      environments/dev/common/config/test-local.php
  19. 2
      environments/prod/common/config/main-local.php
  20. 8
      environments/prod/common/config/params-local.php
  21. 12
      frontend/tests/fixtures/data/user.php
  22. 6
      vagrant/config/vagrant-local.example.yml
  23. 49
      vagrant/nginx/app.conf
  24. 4
      vagrant/nginx/log/.gitignore
  25. 47
      vagrant/nginx/log/static-error.log
  26. 8
      vagrant/provision/always-as-root.sh
  27. 33
      vagrant/provision/once-as-root.sh

9
Vagrantfile vendored

@ -7,9 +7,10 @@ required_plugins.each do |plugin|
end
domains = {
frontend: 'morework.local',
backend: 'admin.morework.local',
static: 'static.morework.local',
frontend: 'zxcms.local',
backend: 'admin.zxcms.local',
static: 'static.zxcms.local',
api: 'api.zxcms.local',
}
config = {
@ -74,5 +75,5 @@ Vagrant.configure(2) do |config|
config.vm.provision 'shell', path: './vagrant/provision/always-as-root.sh', run: 'always'
# post-install message (vagrant console)
config.vm.post_up_message = "Frontend URL: http://#{domains[:frontend]}\nBackend URL: http://#{domains[:backend]}"
config.vm.post_up_message = "Frontend URL: http://#{domains[:frontend]}\nBackend URL: http://#{domains[:backend]}\nStatic URL: http://#{domains[:static]}\nAPI URL: http://#{domains[:api]}"
end

15
api/codeception.yml

@ -0,0 +1,15 @@
namespace: api\tests
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
helpers: tests/_support
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M
modules:
config:
Yii2:
configFile: 'config/test-local.php'

3
api/config/.gitignore vendored

@ -0,0 +1,3 @@
main-local.php
params-local.php
test-local.php

1
api/config/bootstrap.php

@ -0,0 +1 @@
<?php

301
api/config/main.php

@ -0,0 +1,301 @@
<?php
use common\auth\Identity;
use filsh\yii2\oauth2server\filters\auth\CompositeAuth;
use filsh\yii2\oauth2server\filters\ErrorToExceptionFilter;
use filsh\yii2\oauth2server\Module;
use filsh\yii2\oauth2server\Request;
use filsh\yii2\oauth2server\Response;
use OAuth2\GrantType\RefreshToken;
use OAuth2\GrantType\UserCredentials;
use yii\filters\AccessControl;
use yii\filters\auth\HttpBearerAuth;
use yii\filters\auth\QueryParamAuth;
use yii\filters\ContentNegotiator;
use yii\log\FileTarget;
use yii\web\JsonParser;
use yii\web\JsonResponseFormatter;
$params = array_merge(
require __DIR__ . '/../../common/config/params.php',
require __DIR__ . '/../../common/config/params-local.php',
require __DIR__ . '/params.php',
require __DIR__ . '/params-local.php'
);
return [
'id' => 'app-api',
'language' => 'ru',
'basePath' => dirname(__DIR__),
'bootstrap' => [
'log',
'common\bootstrap\SetUp',
'api\bootstrap\SetUp',
[
'class' => ContentNegotiator::class,
'formats' => [
'application/json' => 'json',
'application/xml' => 'xml',
]
]
],
'aliases' => [
'@staticRoot' => $params['staticPath'],
'@static' => $params['staticHostInfo'],
],
'controllerNamespace' => 'api\controllers',
'modules' => [
'oauth2' => [
'class' => Module::class,
'tokenParamName' => 'accessToken',
'tokenAccessLifetime' => 3600 * 24,
'storageMap' => [
'user_credentials' => Identity::class,
],
'components' => [
'request' => function () {
return Request::createFromGlobals();
},
'response' => [
'class' => Response::class,
],
],
'grantTypes' => [
'user_credentials' => [
'class' => UserCredentials::class,
],
'refresh_token' => [
'class' => RefreshToken::class,
'always_issue_new_refresh_token' => true
],
],
],
],
'components' => [
'request' => [
'baseUrl' => '',
'cookieValidationKey' => $params['cookieValidationKey'],
'parsers' => [
'application/json' => JsonParser::class,
],
],
'response' => [
'formatters' => [
'json' => [
'class' => JsonResponseFormatter::class,
'prettyPrint' => YII_DEBUG,
'encodeOptions' => JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE,
],
],
],
'user' => [
'identityClass' => Identity::class,
'enableAutoLogin' => false,
'enableSession' => false,
/*'identityClass' => 'common\auth\Identity',
'enableAutoLogin' => true,
'identityCookie' => ['name' => '_identity', 'httpOnly' => true, 'domain' => $params['cookieDomain']],
'loginUrl' => ['auth/auth/login'],*/
],
/*'session' => [
'name' => '_session',
'class' => 'yii\web\DbSession',
'writeCallback' => function ($session) {
return [
'user_id' => Yii::$app->user->id
];
},
'cookieParams' => [
'domain' => $params['cookieDomain'],
'httpOnly' => true,
],
],*/
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => FileTarget::class,
'levels' => ['error', 'warning'],
],
],
],
'backendUrlManager' => require __DIR__ . '/../../backend/config/urlManager.php',
'frontendUrlManager' => require __DIR__ . '/../../frontend/config/urlManager.php',
'urlManager' => [
'enablePrettyUrl' => true,
'enableStrictParsing' => true,
'showScriptName' => false,
'rules' => [
'' => 'site/index',
'GET offer' => 'site/offer',
'GET profile' => 'user/profile/index',
'PUT profile' => 'user/profile/update',
'GET profile/avatar' => 'user/profile/avatar-get',
'POST profile/avatar' => 'user/profile/avatar-set',
'POST oauth2/<action:\w+>' => 'oauth2/rest/<action>',
'GET cards' => 'card/index',
'GET card/main/<id:\d+>' => 'card/main',
'GET card/contacts/<id:\d+>' => 'card/contacts',
'GET card/education/<id:\d+>' => 'card/education',
'GET card/photos/<id:\d+>' => 'card/photos',
'GET card/biography/<id:\d+>' => 'card/biography',
'GET card/company/<id:\d+>' => 'card/company',
'PUT card/main/<id:\d+>' => 'card/main-update',
'PUT card/contacts/<id:\d+>' => 'card/contacts-update',
'PUT card/education/<id:\d+>' => 'card/education-update',
'PUT card/photos/<id:\d+>' => 'card/photos-update',
'PUT card/biography/<id:\d+>' => 'card/biography-update',
'PUT card/company/<id:\d+>' => 'card/company-update',
'GET card/backgrounds' => 'card/backgrounds',
'POST card' => 'card/create',
'POST card/sort' => 'card/sort',
'DELETE card/<id:\d+>' => 'card/delete',
'PUT card/<id:\d+>' => 'card/update',
'GET card/order/<card_id:\d+>' => 'card/order',
'POST card/upload-file' => 'card/upload-file',
'POST card/delete-file' => 'card/delete-file',
'POST card/photo-process' => 'card/photo-process',
'GET card/block-toggle/<card_id:\d+>/<block_id:\d+>' => 'card/block-toggle',
'POST auth/signup' => 'auth/signup/request',
'POST auth/reset/request' => 'auth/reset/request',
'POST auth/reset/check' => 'auth/reset/check',
'POST auth/reset/confirm' => 'auth/reset/confirm',
],
],
'i18n' => [
'translations' => [
'modules/oauth2/*' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@api/messages',
],
'user' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@frontend/messages',
],
'auth' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@frontend/messages',
],
'main' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@frontend/messages',
],
],
],
/*'errorHandler' => [
'errorAction' => 'site/error',
],
'backendUrlManager' => require __DIR__ . '/../../backend/config/urlManager.php',
'frontendUrlManager' => require __DIR__ . '/urlManager.php',
'urlManager' => function () {
return Yii::$app->get('frontendUrlManager');
},*/
/*'i18n' => [
'translations' => [
'post' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@frontend/messages',
],
'slider' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@frontend/messages',
],
'auth' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@frontend/messages',
],
'user' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@frontend/messages',
],
'main' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@frontend/messages',
],
],
],*
'view' => [
'theme' => [
'basePath' => '@webroot/themes/sport',
'baseUrl' => '@web/themes/sport',
'pathMap' => [
'@frontend/views' => '@webroot/themes/sport',
'@frontend/widgets' => '@webroot/themes/sport/widgets',
],
],
],
'assetManager' => [
'bundles' => [
'yii\web\JqueryAsset' => [
'sourcePath' => '@frontend/assets/libs/jquery321', // do not publish the bundle
'js' => [
YII_ENV_DEV ? 'jquery-3.2.1.js' : 'jquery-3.2.1.min.js'
],
],
'yii\bootstrap\BootstrapAsset' => [
'sourcePath' => '@frontend/assets/libs/bootstrap4/css', // do not publish the bundle
'css' => [
YII_ENV_DEV ? 'bootstrap.css' : 'bootstrap.min.css'
],
],
'yii\bootstrap\BootstrapPluginAsset' => [
'sourcePath' => '@frontend/assets/libs/bootstrap4/js', // do not publish the bundle
'js' => [
YII_ENV_DEV ? 'bootstrap.js' : 'bootstrap.min.js'
],
'depends' => [
'yii\web\JqueryAsset',
'yii\bootstrap\BootstrapAsset',
],
],
],
],*/
],
'as authenticator' => [
'class' => CompositeAuth::class,
'except' => [
'site/index',
'site/offer',
'oauth2/rest/token',
'auth/reset/check',
'auth/reset/confirm',
'auth/reset/request',
'auth/signup/request'
],
'authMethods' => [
['class' => 'yii\filters\auth\HttpBearerAuth'],
['class' => 'yii\filters\auth\QueryParamAuth', 'tokenParam' => 'accessToken'],
]
],
'as access' => [
'class' => AccessControl::class,
'except' => [
'site/index',
'site/offer',
'oauth2/rest/token',
'auth/reset/check',
'auth/reset/confirm',
'auth/reset/request',
'auth/signup/request'
],
'rules' => [
[
'allow' => true,
'roles' => ['@'],
],
],
],
'as exceptionFilter' => [
'class' => ErrorToExceptionFilter::class,
],
'params' => $params,
];

4
api/config/params.php

@ -0,0 +1,4 @@
<?php
return [
//'adminEmail' => 'admin@example.com',
];

4
api/config/test.php

@ -0,0 +1,4 @@
<?php
return [
'id' => 'app-api-tests',
];

BIN
api/web/favicon.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

18
api/web/index-test.php

@ -0,0 +1,18 @@
<?php
// NOTE: Make sure this file is not accessible when deployed to production
if (!in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'])) {
die('You are not allowed to access this file.');
}
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'test');
require __DIR__ . '/../../vendor/autoload.php';
require __DIR__ . '/../../vendor/yiisoft/yii2/Yii.php';
require __DIR__ . '/../../common/config/bootstrap.php';
require __DIR__ . '/../config/bootstrap.php';
$config = require __DIR__ . '/../config/test-local.php';
(new yii\web\Application($config))->run();

25
api/web/index.php

@ -0,0 +1,25 @@
<?php
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
/*if (isset($_SERVER['HTTP_ORIGIN'])) {
// Decide if the origin in $_SERVER['HTTP_ORIGIN'] is one
// you want to allow, and if so:
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 86400'); // cache for 1 day
}*/
require __DIR__ . '/../../vendor/autoload.php';
require __DIR__ . '/../../vendor/yiisoft/yii2/Yii.php';
require __DIR__ . '/../../common/config/bootstrap.php';
require __DIR__ . '/../config/bootstrap.php';
$config = yii\helpers\ArrayHelper::merge(
require __DIR__ . '/../../common/config/main.php',
require __DIR__ . '/../../common/config/main-local.php',
require __DIR__ . '/../config/main.php',
require __DIR__ . '/../config/main-local.php'
);
(new yii\web\Application($config))->run();

2
common/config/bootstrap.php

@ -4,4 +4,4 @@ Yii::setAlias('@frontend', dirname(dirname(__DIR__)) . '/frontend');
Yii::setAlias('@backend', dirname(dirname(__DIR__)) . '/backend');
Yii::setAlias('@console', dirname(dirname(__DIR__)) . '/console');
Yii::setAlias('@core', dirname(dirname(__DIR__)) . '/core');
Yii::setAlias('@api', dirname(dirname(__DIR__)) . '/api');

10
common/runtime/mail/20180211-204419-7974-3045.eml

@ -1,10 +0,0 @@
Message-ID: <20189f40525bb5a2e980be9f0962783e@morework.local>
Date: Sun, 11 Feb 2018 20:44:19 +0000
Subject: 234
From:
To: admin@example.com
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
345

10
common/runtime/mail/20180211-204542-9675-3097.eml

@ -1,10 +0,0 @@
Message-ID: <02451d183d7c136e702e1c2c5da2b33a@morework.local>
Date: Sun, 11 Feb 2018 20:45:42 +0000
Subject: 234
From:
To: admin@example.com
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
sdsfgsf

10
common/runtime/mail/20180211-204830-4001-4976.eml

@ -1,10 +0,0 @@
Message-ID: <87697b396f9ad35d8ff3bed0a033fd4e@morework.local>
Date: Sun, 11 Feb 2018 20:48:30 +0000
Subject: 234
From:
To: admin@example.com
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
555

10
common/runtime/mail/20180211-204904-0101-1020.eml

@ -1,10 +0,0 @@
Message-ID: <b470d88ba02e3115c3ba2082b69315d8@morework.local>
Date: Sun, 11 Feb 2018 20:49:03 +0000
Subject: Test Subj
From:
To: admin@example.com
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
dscsdc

12
common/tests/_data/user.php

@ -3,11 +3,11 @@
return [
'user1' => [
"id" => 1,
"username" => "Error202",
"username" => "user702",
"auth_key" => "I4MJAUm8ZZ4rennRmwhjfeZ7xV2-FpYn",
"password_hash" => '$2y$13$Q/XqSZs.6Y5KYmKf5OhpEOGWoB1GfBjxg8DTTnvionrJrCkezgyZe',
"password_reset_token" => null,
"email" => "error-202@mail.ru",
"email" => "user-702@gmail.com",
"email_confirm_token" => null,
"status" => 10,
"created_at" => 1516021751,
@ -18,11 +18,11 @@ return [
],
'user2' => [
"id" => 17,
"username" => "Error203",
"username" => "user703",
"auth_key" => "wW7PWDP0yUvGVzEqy3dZepb0tj19ejv6",
"password_hash" => '$2y$13$Spf7/iHOj3aJARSORST4s.blouBXtUPLzMf7sD4AX9akSK1URGkfe',
"password_reset_token" => null,
"email" => "error-202@yandex.ru",
"email" => "user-703@gmail.com",
"email_confirm_token" => null,
"status" => 10,
"created_at" => 1518122129,
@ -33,11 +33,11 @@ return [
],
'user3' => [
"id" => 18,
"username" => "zz",
"username" => "user704",
"auth_key" => "JbLkAlfA7jQ0XxbaWxUEPWQCzsVZ9gn8",
"password_hash" => '$2y$13$gyDo.ax9O962rq9pfh6sX.ZHrZ05cTZNAaX8VEMBL7n6UPsMr/vHa',
"password_reset_token" => null,
"email" => "zz@morework.ru",
"email" => "user-704@gmail.com",
"email_confirm_token" => "AcNTOgIMhefCq5tQaOyUqEIeIPLFqFdY",
"status" => 0,
"created_at" => 1518157352,

8
environments/dev/common/config/params-local.php

@ -13,9 +13,9 @@ return [
];
/*
'cookieDomain' => '.morework.local',
'cookieDomain' => '.zxcms.local',
'staticPath' => dirname(__DIR__, 2) . '/static',
'frontendHostInfo' => 'http://morework.local',
'backendHostInfo' => 'http://admin.morework.local',
'staticHostInfo' => 'http://static.morework.local',
'frontendHostInfo' => 'http://zxcms.local',
'backendHostInfo' => 'http://admin.zxcms.local',
'staticHostInfo' => 'http://static.zxcms.local',
*/

2
environments/dev/common/config/test-local.php

@ -6,7 +6,7 @@ return yii\helpers\ArrayHelper::merge(
[
'components' => [
'db' => [
'dsn' => 'mysql:host=localhost;dbname=morework_test',
'dsn' => 'mysql:host=localhost;dbname=zxcms_test',
]
],
]

2
environments/prod/common/config/main-local.php

@ -3,7 +3,7 @@ return [
'components' => [
'db' => [
'class' => 'yii\db\Connection',
//'dsn' => 'mysql:host=localhost;dbname=morework',
//'dsn' => 'mysql:host=localhost;dbname=zxcms',
'dsn' => '',
'username' => '',
'password' => '',

8
environments/prod/common/config/params-local.php

@ -13,9 +13,9 @@ return [
];
/*
'cookieDomain' => '.morework.local',
'cookieDomain' => '.zxcms.local',
'staticPath' => dirname(__DIR__, 2) . '/static',
'frontendHostInfo' => 'http://morework.local',
'backendHostInfo' => 'http://admin.morework.local',
'staticHostInfo' => 'http://static.morework.local',
'frontendHostInfo' => 'http://zxcms.local',
'backendHostInfo' => 'http://admin.zxcms.local',
'staticHostInfo' => 'http://static.zxcms.local',
*/

12
frontend/tests/fixtures/data/user.php vendored

@ -3,11 +3,11 @@
return [
'user1' => [
"id" => 1,
"username" => "Error202",
"username" => "user701",
"auth_key" => "I4MJAUm8ZZ4rennRmwhjfeZ7xV2-FpYn",
"password_hash" => "$2y$13$53Y5IhwZyUkvLirp.qq.o.J0XRDOPRFVCbkHSzYXKVb6.DbdM9uYy",
"password_reset_token" => null,
"email" => "error-202@mail.ru",
"email" => "user-701@gmail.com",
"email_confirm_token" => null,
"status" => 10,
"created_at" => 1516021751,
@ -18,11 +18,11 @@ return [
],
'user2' => [
"id" => 17,
"username" => "Error203",
"username" => "user703",
"auth_key" => "wW7PWDP0yUvGVzEqy3dZepb0tj19ejv6",
"password_hash" => '$2y$13$Spf7/iHOj3aJARSORST4s.blouBXtUPLzMf7sD4AX9akSK1URGkfe',
"password_reset_token" => null,
"email" => "error-202@yandex.ru",
"email" => "user-703@gmail.com",
"email_confirm_token" => null,
"status" => 10,
"created_at" => 1518122129,
@ -33,11 +33,11 @@ return [
],
'user3' => [
"id" => 18,
"username" => "zz",
"username" => "user704",
"auth_key" => "JbLkAlfA7jQ0XxbaWxUEPWQCzsVZ9gn8",
"password_hash" => '$2y$13$gyDo.ax9O962rq9pfh6sX.ZHrZ05cTZNAaX8VEMBL7n6UPsMr/vHa',
"password_reset_token" => null,
"email" => "zz@morework.ru",
"email" => "user-704@gmail.com",
"email_confirm_token" => "AcNTOgIMhefCq5tQaOyUqEIeIPLFqFdY",
"status" => 0,
"created_at" => 1518157352,

6
vagrant/config/vagrant-local.example.yml

@ -1,5 +1,5 @@
# Your personal GitHub token
github_token: 87c011e7ff30a9d6218f2e946e4e4b8161bee640
github_token:
# Read more: https://github.com/blog/1509-personal-api-tokens
# You can generate it here: https://github.com/settings/tokens
@ -10,10 +10,10 @@ timezone: Europe/Moscow
box_check_update: false
# Virtual machine name
machine_name: morework.dev
machine_name: zxcms.local
# Virtual machine IP
ip: 192.168.83.83
ip: 192.168.83.1
# Virtual machine CPU cores number
cpus: 1

49
vagrant/nginx/app.conf

@ -6,7 +6,7 @@ server {
listen 80; ## listen for ipv4
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
server_name morework.local;
server_name zxcms.local;
root /app/frontend/web/;
index index.php;
@ -28,7 +28,7 @@ server {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
try_files $uri =404;
}
@ -45,7 +45,7 @@ server {
listen 80; ## listen for ipv4
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
server_name admin.morework.local;
server_name admin.zxcms.local;
root /app/backend/web/;
index index.php;
@ -67,7 +67,7 @@ server {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
try_files $uri =404;
}
@ -84,7 +84,46 @@ server {
listen 80; ## listen for ipv4
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
server_name static.morework.local;
server_name api.zxcms.local;
root /app/api/web/;
index index.php;
access_log /app/vagrant/nginx/log/api-access.log;
error_log /app/vagrant/nginx/log/api-error.log;
location / {
# Redirect everything that isn't a real file to index.php
try_files $uri $uri/ /index.php$is_args$args;
}
# uncomment to avoid processing of calls to non-existing static 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_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
try_files $uri =404;
}
location ~ /\.(ht|svn|git) {
deny all;
}
}
server {
charset utf-8;
client_max_body_size 128M;
sendfile off;
listen 80; ## listen for ipv4
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
server_name static.zxcms.local;
root /app/static/;
error_log /app/vagrant/nginx/log/static-error.log;

4
vagrant/nginx/log/.gitignore vendored

@ -2,4 +2,6 @@
backend-access.log
backend-error.log
frontend-access.log
frontend-error.log
frontend-error.log
static-access.log
static-error.log

47
vagrant/nginx/log/static-error.log

@ -1,47 +0,0 @@
2018/01/16 19:15:37 [error] 1912#1912: *160 open() "/app/static/favicon.ico" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.dev, request: "GET /favicon.ico HTTP/1.1", host: "static.morework.dev"
2018/01/16 19:15:37 [error] 1912#1912: *160 open() "/app/static/favicon.ico" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.dev, request: "GET /favicon.ico HTTP/1.1", host: "static.morework.dev"
2018/01/27 14:32:59 [error] 1935#1935: *199 open() "/app/static/photos/shutterstock_773261143_gb3tD.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /photos/shutterstock_773261143_gb3tD.jpg HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/slider/update?id=1"
2018/01/27 14:32:59 [error] 1935#1935: *199 open() "/app/static/photos/shutterstock_773261143_gb3tD.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /photos/shutterstock_773261143_gb3tD.jpg HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/slider/update?id=1"
2018/01/29 01:46:25 [error] 1838#1838: *1499 open() "/app/static/cache/posts/thumb_gallery_view_10.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_10.jpg HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/post/post/view?id=10"
2018/01/29 01:46:37 [error] 1838#1838: *1499 open() "/app/static/cache/posts/thumb_gallery_view_10.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_10.jpg HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/post/post/update?id=10"
2018/01/29 01:46:37 [error] 1838#1838: *1499 open() "/app/static/cache/posts/thumb_gallery_view_10.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_10.jpg HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/post/post/update?id=10"
2018/01/29 01:48:03 [error] 1838#1838: *1499 open() "/app/static/cache/posts/thumb_gallery_view_10.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_10.jpg HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/post/post/view?id=10"
2018/01/29 01:52:07 [error] 1838#1838: *1508 open() "/app/static/cache/posts/thumb_gallery_view_10.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_10.jpg HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/post/post/update?id=10"
2018/01/29 01:52:07 [error] 1838#1838: *1508 open() "/app/static/cache/posts/thumb_gallery_view_10.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_10.jpg HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/post/post/update?id=10"
2018/01/29 01:52:34 [error] 1838#1838: *1508 open() "/app/static/cache/posts/thumb_gallery_view_10.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_10.jpg HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/post/post/view?id=10"
2018/01/29 01:54:38 [error] 1838#1838: *1516 open() "/app/static/cache/posts/thumb_gallery_view_10.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_10.jpg HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/post/post/update?id=10"
2018/01/29 01:54:39 [error] 1838#1838: *1516 open() "/app/static/cache/posts/thumb_gallery_view_10.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_10.jpg HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/post/post/update?id=10"
2018/01/29 02:20:41 [error] 1838#1838: *1551 open() "/app/static/cache/posts/thumb_gallery_view_10.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_10.jpg HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/post/post/view?id=10"
2018/01/29 02:21:04 [error] 1838#1838: *1551 open() "/app/static/cache/posts/thumb_gallery_view_10.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_10.jpg HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/post/post/update?id=10"
2018/01/29 02:21:04 [error] 1838#1838: *1551 open() "/app/static/cache/posts/thumb_gallery_view_10.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_10.jpg HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/post/post/update?id=10"
2018/07/06 10:04:55 [error] 1920#1920: *1218 open() "/app/static/cache/posts/blog_post_-1.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/blog_post_-1.jpg HTTP/1.1", host: "static.morework.local", referrer: "http://morework.local/blog/post/preview"
2018/07/06 10:17:34 [error] 1920#1920: *1225 open() "/app/static/cache/posts/blog_post_-1.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/blog_post_-1.jpg HTTP/1.1", host: "static.morework.local", referrer: "http://morework.local/blog/post/preview"
2018/07/06 10:17:57 [error] 1920#1920: *1225 open() "/app/static/cache/posts/blog_post_-1.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/blog_post_-1.jpg HTTP/1.1", host: "static.morework.local"
2018/07/06 10:18:44 [error] 1920#1920: *1228 open() "/app/static/cache/posts/blog_post_-1.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/blog_post_-1.jpg HTTP/1.1", host: "static.morework.local", referrer: "http://morework.local/blog/post/preview"
2018/07/06 10:20:25 [error] 1920#1920: *1232 open() "/app/static/cache/posts/blog_post_-1.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/blog_post_-1.jpg HTTP/1.1", host: "static.morework.local", referrer: "http://morework.local/blog/post/preview"
2018/07/25 14:48:26 [error] 1933#1933: *552 open() "/app/static/cache/posts/blog_post_13.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/blog_post_13.jpg HTTP/1.1", host: "static.morework.local", referrer: "http://morework.local/blog/post/preview?id=22"
2018/07/25 14:49:11 [error] 1933#1933: *558 open() "/app/static/cache/posts/blog_post_23.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/blog_post_23.jpg HTTP/1.1", host: "static.morework.local", referrer: "http://morework.local/blog/post/preview?id=23"
2018/07/25 14:49:57 [error] 1933#1933: *558 open() "/app/static/cache/posts/blog_post_24.png" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/blog_post_24.png HTTP/1.1", host: "static.morework.local", referrer: "http://morework.local/blog/post/preview?id=24"
2018/07/25 14:50:22 [error] 1933#1933: *558 open() "/app/static/cache/posts/blog_post_25.png" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/blog_post_25.png HTTP/1.1", host: "static.morework.local", referrer: "http://morework.local/blog/post/preview?id=25"
2018/07/25 14:55:07 [error] 1933#1933: *583 open() "/app/static/cache/posts/blog_post_26.png" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/blog_post_26.png HTTP/1.1", host: "static.morework.local", referrer: "http://morework.local/blog/post/preview?id=26"
2018/07/25 14:55:25 [error] 1933#1933: *583 open() "/app/static/cache/posts/blog_post_26.png" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/blog_post_26.png HTTP/1.1", host: "static.morework.local"
2018/07/25 14:55:32 [error] 1933#1933: *583 open() "/app/static/cache/posts/blog_post_26.png" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/blog_post_26.png HTTP/1.1", host: "static.morework.local"
2018/07/25 15:14:57 [error] 1933#1933: *638 open() "/app/static/cache/posts/blog_post_28.png" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/blog_post_28.png HTTP/1.1", host: "static.morework.local", referrer: "http://morework.local/blog/post/preview?id=28"
2018/07/25 15:19:30 [error] 1933#1933: *663 open() "/app/static/cache/posts/blog_post_30.png" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/blog_post_30.png HTTP/1.1", host: "static.morework.local", referrer: "http://morework.local/blog/post/preview?id=30"
2018/07/25 15:33:18 [error] 1933#1933: *669 open() "/app/static/cache/posts/blog_post_31.png" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/blog_post_31.png HTTP/1.1", host: "static.morework.local", referrer: "http://morework.local/blog/post/preview?id=31"
2018/07/25 15:35:13 [error] 1933#1933: *676 open() "/app/static/cache/posts/blog_post_32.png" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/blog_post_32.png HTTP/1.1", host: "static.morework.local", referrer: "http://morework.local/blog/post/preview?id=32"
2018/07/25 20:06:07 [error] 1933#1933: *946 open() "/app/static/cache/posts/blog_post_53.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/blog_post_53.jpg HTTP/1.1", host: "static.morework.local", referrer: "http://morework.local/blog/post/preview?id=53"
2018/07/25 23:05:07 [error] 1933#1933: *1256 open() "/app/static/cache/posts/thumb_gallery_view_68.jpg" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_68.jpg HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/blog/manage/post/view/68"
2018/07/25 23:36:51 [error] 1933#1933: *1389 open() "/app/static/cache/posts/thumb_gallery_view_27.png" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_27.png HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/blog/manage/post/view/27"
2018/07/25 23:47:55 [error] 1933#1933: *1465 open() "/app/static/cache/posts/thumb_gallery_view_83.png" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_83.png HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/blog/manage/post/view/83"
2018/07/25 23:48:13 [error] 1933#1933: *1465 open() "/app/static/cache/posts/thumb_gallery_view_83.png" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_83.png HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/blog/manage/post/update?id=83"
2018/07/25 23:48:13 [error] 1933#1933: *1465 open() "/app/static/cache/posts/thumb_gallery_view_83.png" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_83.png HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/blog/manage/post/update?id=83"
2018/07/25 23:50:33 [error] 1933#1933: *1497 open() "/app/static/cache/posts/thumb_gallery_view_83.png" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_83.png HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/blog/manage/post/view/83"
2018/07/25 23:50:39 [error] 1933#1933: *1497 open() "/app/static/cache/posts/thumb_gallery_view_83.png" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_83.png HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/blog/manage/post/update?id=83"
2018/07/25 23:50:39 [error] 1933#1933: *1497 open() "/app/static/cache/posts/thumb_gallery_view_83.png" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_83.png HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/blog/manage/post/update?id=83"
2018/07/25 23:51:08 [error] 1933#1933: *1497 open() "/app/static/cache/posts/thumb_gallery_view_83.png" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_83.png HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/blog/manage/post/view/83"
2018/07/25 23:51:14 [error] 1933#1933: *1497 open() "/app/static/cache/posts/thumb_gallery_view_83.png" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_83.png HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/blog/manage/post/update?id=83"
2018/07/25 23:51:14 [error] 1933#1933: *1497 open() "/app/static/cache/posts/thumb_gallery_view_83.png" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_83.png HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/blog/manage/post/update?id=83"
2018/07/26 15:10:09 [error] 1933#1933: *1523 open() "/app/static/cache/posts/thumb_gallery_view_83.png" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /cache/posts/thumb_gallery_view_83.png HTTP/1.1", host: "static.morework.local", referrer: "http://admin.morework.local/blog/manage/post/view/83"
2018/09/25 09:36:44 [error] 1951#1951: *1806 open() "/app/static/robots.txt" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /robots.txt HTTP/1.1", host: "static.morework.local"
2018/09/25 09:36:44 [error] 1951#1951: *1804 open() "/app/static/favicon.ico" failed (2: No such file or directory), client: 192.168.83.1, server: static.morework.local, request: "GET /favicon.ico HTTP/1.1", host: "static.morework.local", referrer: "http://static.morework.local/origin/products/1/1.jpg"

8
vagrant/provision/always-as-root.sh

@ -13,9 +13,9 @@ function info {
info "Provision-script user: `whoami`"
info "Restart web-stack"
service php7.1-fpm restart
service php7.4-fpm restart
service nginx restart
service mysql restart
service elasticsearch restart
service redis restart
service supervisor restart
#service elasticsearch restart
#service redis restart
#service supervisor restart

33
vagrant/provision/once-as-root.sh

@ -26,15 +26,15 @@ debconf-set-selections <<< "mysql-community-server mysql-community-server/root-p
debconf-set-selections <<< "mysql-community-server mysql-community-server/re-root-pass password \"''\""
echo "Done!"
info "Add PHp 7.1 repository"
info "Add PHP repository"
add-apt-repository ppa:ondrej/php -y
info "Add Oracle JDK repository"
add-apt-repository ppa:webupd8team/java -y
info "Add ElasticSearch sources"
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -
echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-5.x.list
#info "Add ElasticSearch sources"
#wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -
#echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-5.x.list
info "Update OS software"
apt-get update
@ -42,24 +42,25 @@ apt-get upgrade -y
info "Install additional software"
#apt-get install -y php7.0-curl php7.0-cli php7.0-intl php7.0-mysqlnd php7.0-gd php7.0-fpm php7.0-mbstring php7.0-xml unzip nginx mysql-server-5.7 php.xdebug
apt-get install -y php7.1-curl php7.1-cli php7.1-intl php7.1-mysqlnd php7.1-gd php7.1-fpm php7.1-mbstring php7.1-xml php7.1-zip unzip nginx mysql-server-5.7 php.xdebug
#apt-get install -y php7.1-curl php7.1-cli php7.1-intl php7.1-mysqlnd php7.1-gd php7.1-fpm php7.1-mbstring php7.1-xml php7.1-zip unzip nginx mysql-server-5.7 php.xdebug
apt-get install -y php7.4-curl php7.4-cli php7.4-intl php7.4-mysql php7.4-gd php7.4-fpm php7.4-mbstring php7.4-xml php7.4-zip unzip nginx mysql-server-5.7 libmagickwand-dev imagemagick php-dev php-imagick
info "Install Oracle JDK"
debconf-set-selections <<< "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true"
debconf-set-selections <<< "oracle-java8-installer shared/accepted-oracle-license-v1-1 seen true"
apt-get install -y oracle-java8-installer
info "Install ElasticSearch"
apt-get install -y elasticsearch
sed -i 's/-Xms2g/-Xms64m/' /etc/elasticsearch/jvm.options
sed -i 's/-Xmx2g/-Xmx64m/' /etc/elasticsearch/jvm.options
service elasticsearch restart
#info "Install ElasticSearch"
#apt-get install -y elasticsearch
#sed -i 's/-Xms2g/-Xms64m/' /etc/elasticsearch/jvm.options
#sed -i 's/-Xmx2g/-Xmx64m/' /etc/elasticsearch/jvm.options
#service elasticsearch restart
info "Install Redis"
apt-get install -y redis-server
#info "Install Redis"
#apt-get install -y redis-server
info "Install Supervisor"
apt-get install -y supervisor
#info "Install Supervisor"
#apt-get install -y supervisor
info "Configure MySQL"
sed -i "s/.*bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/mysql.conf.d/mysqld.cnf
@ -91,8 +92,8 @@ ln -s /app/vagrant/nginx/app.conf /etc/nginx/sites-enabled/app.conf
echo "Done!"
info "Initailize databases for MySQL"
mysql -uroot <<< "CREATE DATABASE morework"
mysql -uroot <<< "CREATE DATABASE morework_test"
mysql -uroot <<< "CREATE DATABASE zxcms"
mysql -uroot <<< "CREATE DATABASE zxcms_test"
echo "Done!"
info "Enabling supervisor processes"

Loading…
Cancel
Save