diff --git a/README.md b/README.md index 1755288..ee78863 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,9 @@ -

- -

- -

- Build Status - Quality Score - Total Downloads - Latest Stable Version - License -

- -

This is a community project and not an official Laravel one

- -Laravel Zero was created by, and is maintained by [Nuno Maduro](https://github.com/nunomaduro), and is a micro-framework that provides an elegant starting point for your console application. It is an **unofficial** and customized version of Laravel optimized for building command-line applications. - -- Built on top of the [Laravel](https://laravel.com) components. -- Optional installation of Laravel [Eloquent](https://laravel-zero.com/docs/database/), Laravel [Logging](https://laravel-zero.com/docs/logging/) and many others. -- Supports interactive [menus](https://laravel-zero.com/docs/build-interactive-menus/) and [desktop notifications](https://laravel-zero.com/docs/send-desktop-notifications/) on Linux, Windows & MacOS. -- Ships with a [Scheduler](https://laravel-zero.com/docs/task-scheduling/) and a [Standalone Compiler](https://laravel-zero.com/docs/build-a-standalone-application/). -- Integration with [Collision](https://github.com/nunomaduro/collision) - Beautiful error reporting - ------- +# MCP ## Documentation -For full documentation, visit [laravel-zero.com](https://laravel-zero.com/). - -## Support the development -**Do you like this project? Support it by donating** - -- PayPal: [Donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L) -- Patreon: [Donate](https://www.patreon.com/nunomaduro) +## Contribute ## License -Laravel Zero is an open-source software licensed under the [MIT license](https://github.com/laravel-zero/laravel-zero/blob/stable/LICENSE.md). +MCP is an open-source software licensed under the [MIT license](https://github.com/laravel-zero/laravel-zero/blob/stable/LICENSE.md). diff --git a/app/Commands/NginxVhostsCommand.php b/app/Commands/NginxVhostsCommand.php index 79d5c06..9c8883f 100644 --- a/app/Commands/NginxVhostsCommand.php +++ b/app/Commands/NginxVhostsCommand.php @@ -5,8 +5,10 @@ namespace App\Commands; use Illuminate\Console\Scheduling\Schedule; use LaravelZero\Framework\Commands\Command; use Illuminate\Support\Facades\File; +use Jenssegers\Blade\Blade; use App\Facades\Install; +use App\Facades\NginxVhost; use PhpSchool\CliMenu\Builder\CliMenuBuilder; use PhpSchool\CliMenu\CliMenu; @@ -14,11 +16,12 @@ use PhpSchool\CliMenu\MenuItem\CheckboxItem; use PhpSchool\CliMenu\Style\SelectableStyle; use Log; +use Closure; class NginxVhostsCommand extends Command { // path templates - const TEMPLATES_DIR = '/resources/templates/nginx'; + const TEMPLATES_DIR = '/resources/nginx/templates'; /** * The signature of the command. @@ -39,138 +42,227 @@ class NginxVhostsCommand extends Command * * */ - private function add(CliMenuBuilder $builder) + private function getTemplates($prefix = '') { + // templates + $templates = []; + // getting templates + $files = scandir(base_path().self::TEMPLATES_DIR); + + foreach($files as $file) { + + // create filepath + $filepath = base_path().self::TEMPLATES_DIR.'/'.$file; + + // getting info + $pathinfo = pathinfo($filepath); + + // if extension isset and php + if (isset($pathinfo['extension']) && $pathinfo['extension'] === 'php') { + + $name = str_replace('.blade.php', '', $file); + + $templates[] = [ + 'name' => $name, + 'file' => $file, + 'filepath' => $filepath + ]; + } + } + + return $templates; } /** - * Execute the console command. * - * @return mixed + * + * */ - public function handle() + private function selectTemplate() { - // create menu - $main = $this->menu(self::MENU_TITLE) - ->addSubMenu('add', function(CliMenuBuilder $builder) { - - // getting templates - $templates = scandir(base_path().self::TEMPLATES_DIR); - - foreach($templates as $template) { - $builder - ->addSubMenu($template, function(CliMenuBuilder $builder) use ($template) { - - $configuration = [ - 'domain' => '', - 'ssl' => true, - 'redirect_www' => true - ]; - - $checkboxSSL = new CheckboxItem('ssl', function(CliMenu $menu) use (&$configuration) { - $configuration['ssl'] = $menu->getSelectedItem()->getChecked(); - }); - - $checkboxSSL->setChecked($configuration['ssl']); - - $checkboxRedirect = new CheckboxItem('redirect www', function(CliMenu $menu) use (&$configuration) { - $configuration['redirect www'] = $menu->getSelectedItem()->getChecked(); - }); - - $checkboxRedirect->setChecked($configuration['redirect_www']); - - $builder - ->setTitle('Nginx Vhosts > add > '.$template) - ->addItem('domain', function(CliMenu $menu) use (&$configuration) { - $result = $menu->askText()->ask(); - $configuration['domain'] = $result->fetch(); - - $menu->getSelectedItem()->setText('domain -> '.$result->fetch()); - $menu->redraw(); - }) - ->addLineBreak('-') - ->addMenuItem($checkboxSSL) - ->addMenuItem($checkboxRedirect) - ->addLineBreak('-') - ->addItem('save', function() use (&$configuration) { - var_dump($configuration); - }) - ->addLineBreak('-'); - }); - } + // getting templates + $templates = $this->getTemplates(); + + $menu = function(CliMenuBuilder $builder) use ($templates) + { + // writing configuration + $blade = new Blade(base_path().self::TEMPLATES_DIR, base_path().'/storage/cache'); + + $builder + ->setTitle('Nginx > add') + ->setGoBackButtonText('Back'); + + foreach($templates as $template) { + $submenuCallable = $this->createConfiguration($template, $blade); + $builder + ->addSubMenu($template['name'], $submenuCallable); + } - //exec('touch /etc/nginx/sites-available/'); - }) - ->addLineBreak('-'); + $builder->addLineBreak('-'); + }; - /*** + return $menu; + } - $itemCallable = function(CliMenu $menu) { + /** + * + * + * @param [type] $template [description] + * @param [type] $blade [description] + * @return [type] [description] + */ + private function createConfiguration($template, $blade) + { + $menu = function(CliMenuBuilder $builder) use ($template, $blade) + { + $configuration = [ + 'domain' => '', + 'root' => '', + 'index' => 'index.php', + 'ssl' => true, + 'redirect_www' => true + ]; + + // create checkbox for ssl + $checkboxSSL = new CheckboxItem('ssl', function(CliMenu $menu) use (&$configuration) { + $configuration['ssl'] = $menu->getSelectedItem()->getChecked(); + }); + + $checkboxSSL->setChecked($configuration['ssl']); + + // create checkbox for redirect from www + $checkboxRedirect = new CheckboxItem('redirect www', function(CliMenu $menu) use (&$configuration) { + $configuration['redirect_www'] = $menu->getSelectedItem()->getChecked(); + }); + + $checkboxRedirect->setChecked($configuration['redirect_www']); + + $builder + ->setTitle('Nginx Vhosts > add > '.$template['name']) + ->addItem('domain', function(CliMenu $menu) use (&$configuration) { + $result = $menu->askText()->ask(); + $configuration['domain'] = $result->fetch(); + + $menu->getSelectedItem()->setText('domain -> '.$result->fetch()); + $menu->redraw(); + }) + ->addItem('root', function(CliMenu $menu) use (&$configuration) { + $result = $menu->askText()->ask(); + $configuration['root'] = $result->fetch(); + + $menu->getSelectedItem()->setText('root -> '.$result->fetch()); + $menu->redraw(); + }) + ->addItem($configuration['index'], function(CliMenu $menu) use (&$configuration) { + $result = $menu->askText()->ask(); + $configuration['index'] = $result->fetch(); + + $menu->getSelectedItem()->setText($result->fetch()); + $menu->redraw(); + }) + ->addLineBreak('-') + ->addMenuItem($checkboxSSL) + ->addMenuItem($checkboxRedirect) + ->addLineBreak('-') + ->addItem('save', function() use (&$configuration, $template, $blade) { + $content = $blade->render($template['name'], $configuration); + file_put_contents('/etc/nginx/sites-available/'.$configuration['domain'].'.conf', $content); + }) + ->addLineBreak('-'); + }; + + return $menu; + } - // getting sites-available - $sitesAvailable = scandir('/etc/nginx/sites-available'); + /** + * create submenu for vhost + * + * + * @param array $vhost + * @return CliMenuBuilder + * + */ + private function vhost($vhost) + { + $menu = function(CliMenuBuilder $builder) use ($vhost) + { + $checkbox = new CheckboxItem('enabled', function(CliMenu $menu) use ($vhost) { + + // check status + if ($menu->getSelectedItem()->getChecked()) { + symlink('/etc/nginx/sites-available/'.$vhost['file'], '/etc/nginx/sites-enabled/'.$vhost['file']); + $status = 'enabled'; + } else { + unlink('/etc/nginx/sites-enabled/'.$vhost['file']); + $status = 'disabled'; + } - // getting sites-endabled - $sitesEnabled = scandir('/etc/nginx/sites-enabled'); + // restart + exec('service nginx restart'); + exec('service nginx status', $output); - foreach($sitesAvailable as $site) { - if ($site !== '.' && $site !== '..') { + if (strpos(implode(' ', $output), 'active') !== false) { + $menu->confirm($vhost['domain'].' is '.$status.'!')->display('OK!'); + } else { + $menu->confirm('Error! Something not working!')->display('OK!'); + } - // getting title - $title = str_replace('.conf', '', $site); + }); - $checkbox = new CheckboxItem('enabled', function(CliMenu $menu) use ($site, $title) { + // adding checkbox + if ($vhost['enabled']) { + $checkbox->setChecked(true); + } - // check status - if ($menu->getSelectedItem()->getChecked()) { - symlink('/etc/nginx/sites-available/'.$site, '/etc/nginx/sites-enabled/'.$site); - $status = 'enabled'; - } else { - unlink('/etc/nginx/sites-enabled/'.$site); - $status = 'disabled'; - } + $builder + ->setTitle('Nginx > '.$vhost['domain']) + ->setGoBackButtonText('Back') + ->addItem('edit', function(CliMenu $menu) use ($vhost) { + system('nano /etc/nginx/sites-available/'.$vhost['file'].' > `tty`'); + }) + ->addItem('delete', function(CliMenu $menu) use ($vhost) { + if (file_exists('/etc/nginx/sites-enabled/'.$vhost['file'])) { + $menu->confirm('Error! Please disable '.$vhost['domain'].' first!')->display('OK!'); + } else { + unlink('/etc/nginx/sites-available/'.$vhost['file']); + $menu->confirm($vhost['domain'].' is deleted!')->display('OK!'); + } + }) + ->addLineBreak('-') + ->addMenuItem($checkbox) + ->addLineBreak('-'); + }; - // starting - exec('service nginx restart'); - exec('service nginx status', $output); + return $menu; + } - if (strpos(implode(' ', $output), 'active') !== false) { - $menu->confirm($title.' is '.$status.'!')->display('OK!'); - } else { - $menu->confirm('Error! Something not working!')->display('OK!'); - } + /** + * let it rain + * + * + */ + public function handle() + { + $submenuSelectTemplate = $this->selectTemplate(); - }); + // create menu + $main = $this->menu('Nginx') - // adding checkbox - if (in_array($site, $sitesEnabled)) { - $checkbox->setChecked(true); - } + // add Submenu for select templates + ->addSubMenu('add', $submenuSelectTemplate) + ->addLineBreak('-'); - $menuMain - ->addSubmenu($title, function(CliMenuBuilder $builder) use ($site, $title, $checkbox) { - $builder->setTitle("Nginx > $title") - ->addItem('edit', function(CliMenu $menu) use ($site, $title) { - system('nano /etc/nginx/sites-available/'.$site.' > `tty`'); - }) - ->addItem('delete', function(CliMenu $menu) use ($site) { - if (file_exists('/etc/nginx/sites-enabled/'.$site)) { - $menu->confirm('Error! Please disable '.$title.' first!')->display('OK!'); - } else { - unlink('/etc/nginx/sites-available/'.$site); - $menu->confirm("$site is deleted!")->display('OK!'); - } - }) - ->addLineBreak('-') - ->addMenuItem($checkbox) - ->addLineBreak('-'); - }); + // getting vhosts + $vhosts = NginxVhost::find(); - } - } - };*/ + // add submenu for each vhost + foreach($vhosts as $vhost) { + $submenuEditVhost = $this->vhost($vhost); + $main->addSubMenu($vhost['domain'], $submenuEditVhost); + } - $main->addLineBreak('-')->open(); + $main->addLineBreak('-'); + $main->open(); } } diff --git a/app/Facades/Nginx.php b/app/Facades/NginxVhost.php similarity index 79% rename from app/Facades/Nginx.php rename to app/Facades/NginxVhost.php index fac24ec..1f5f30d 100644 --- a/app/Facades/Nginx.php +++ b/app/Facades/NginxVhost.php @@ -11,10 +11,10 @@ use Illuminate\Support\Facades\Facade; * @license http://opensource.org/licenses/MIT The MIT License * @link https://github.com/nirgendswo/fuzzy-cms GitHub Repository */ -class Nginx extends Facade +class NginxVhost extends Facade { protected static function getFacadeAccessor() { - return 'App\Helpers\NginxHelper'; + return 'App\Helpers\NginxVhostHelper'; } } diff --git a/app/Helpers/NginxConfigurationHelper.php b/app/Helpers/NginxVhostHelper.php similarity index 99% rename from app/Helpers/NginxConfigurationHelper.php rename to app/Helpers/NginxVhostHelper.php index a3dc75a..d5fe23f 100644 --- a/app/Helpers/NginxConfigurationHelper.php +++ b/app/Helpers/NginxVhostHelper.php @@ -8,7 +8,7 @@ namespace App\Helpers; * * */ -class NginxHelper +class NginxVhostHelper { // path for available files const SITES_AVAILABLE = '/etc/nginx/sites-available'; diff --git a/resources/nginx/templates/.gitkeep b/resources/nginx/templates/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/resources/nginx/templates/flight.blade.php b/resources/nginx/templates/flight.blade.php new file mode 100644 index 0000000..6a7cf1d --- /dev/null +++ b/resources/nginx/templates/flight.blade.php @@ -0,0 +1,10 @@ +@extends($ssl ? 'layouts.ssl' : 'layouts.no-ssl') + +@section('server') +root {{ $root }}; +index {{ $index }}; + +location / { + try_files $uri $uri/ /index.php; +} +@endsection \ No newline at end of file diff --git a/resources/nginx/templates/laravel.blade.php b/resources/nginx/templates/laravel.blade.php new file mode 100644 index 0000000..7931acb --- /dev/null +++ b/resources/nginx/templates/laravel.blade.php @@ -0,0 +1 @@ +@extends($ssl ? 'layouts.ssl' : 'layouts.no-ssl') \ No newline at end of file diff --git a/resources/nginx/templates/layouts/no-ssl.blade.php b/resources/nginx/templates/layouts/no-ssl.blade.php new file mode 100644 index 0000000..9b75a66 --- /dev/null +++ b/resources/nginx/templates/layouts/no-ssl.blade.php @@ -0,0 +1,16 @@ +server { + listen 80; + listen [::]:80; + server_name {{ $domain }} @if ($redirect_www) www.{{ $domain }} @endif; + return 301 http://{{ $domain }}$request_uri; +} + +server { + listen 80; + listen [::]:80; + + @include('partials.default', ['domain' => $domain]) + + @section('server') + @show +} \ No newline at end of file diff --git a/resources/nginx/templates/layouts/ssl.blade.php b/resources/nginx/templates/layouts/ssl.blade.php new file mode 100644 index 0000000..7f6698f --- /dev/null +++ b/resources/nginx/templates/layouts/ssl.blade.php @@ -0,0 +1,44 @@ +server { + listen 80; + listen [::]:80; + server_name {{ $domain }} @if ($redirect_www) www.{{ $domain }} @endif; + return 301 https://{{ $domain }}$request_uri; +} + +@if ($redirect_www) +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + + ssl_certificate /etc/letsencrypt/live/www.{{ $domain }}/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/www.{{ $domain }}/privkey.pem; + + include snippets/ssl-params.conf; + include /etc/nginx/snippets/secure-headers.conf; + + server_name www.{{ $domain }}; + return 301 https://{{ $domain }}$request_uri; +} +@endif + +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + + ssl_certificate /etc/letsencrypt/live/{{ $domain }}/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/{{ $domain }}/privkey.pem; + + add_header Content-Security-Policy " + default-src 'self'; + font-src 'self'; + style-src 'self'; + img-src 'self'; + base-uri 'self'; + form-action 'self'; + frame-ancestors 'self'; + "; + + @include('partials.default', ['domain' => $domain]) + + @yield('server') +} \ No newline at end of file diff --git a/resources/nginx/templates/partials/default.blade.php b/resources/nginx/templates/partials/default.blade.php new file mode 100644 index 0000000..4deda7b --- /dev/null +++ b/resources/nginx/templates/partials/default.blade.php @@ -0,0 +1,9 @@ +server_name {{ $domain }}; + +# include snippets +include /etc/nginx/snippets/deny.conf; +include /etc/nginx/snippets/expires.conf; + +# logs +access_log /var/log/nginx/{{ $domain }}.access.log; +error_log /var/log/nginx/{{ $domain }}.error.log; \ No newline at end of file diff --git a/resources/nginx/templates/php.blade.php b/resources/nginx/templates/php.blade.php new file mode 100644 index 0000000..7931acb --- /dev/null +++ b/resources/nginx/templates/php.blade.php @@ -0,0 +1 @@ +@extends($ssl ? 'layouts.ssl' : 'layouts.no-ssl') \ No newline at end of file diff --git a/resources/nginx/templates/reverse-proxy.blade.php b/resources/nginx/templates/reverse-proxy.blade.php new file mode 100644 index 0000000..67a1359 --- /dev/null +++ b/resources/nginx/templates/reverse-proxy.blade.php @@ -0,0 +1,5 @@ +@extends($ssl ? 'layouts.ssl' : 'layouts.no-ssl') + +@section('server') + +@endsection \ No newline at end of file diff --git a/resources/nginx/templates/wordpress.blade.php b/resources/nginx/templates/wordpress.blade.php new file mode 100644 index 0000000..5e89ced --- /dev/null +++ b/resources/nginx/templates/wordpress.blade.php @@ -0,0 +1,45 @@ +@extends($ssl ? 'layouts.ssl' : 'layouts.no-ssl') + +@section('server') +root {{ $root }}; +index {{ $index }}; + +# rewrite +location / { + try_files $uri $uri/ /index.php?$args; +} + +location = /favicon.ico { + log_not_found off; + access_log off; +} + +location = /robots.txt { + allow all; + log_not_found off; + access_log off; +} + +location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { + expires max; + log_not_found off; +} + +location ~ /\. { + deny all; +} + +location ~* /(?:uploads|files)/.*\.php$ { + deny all; +} + +# php-fpm configuration. +location ~ \.php(/|$) { + fastcgi_split_path_info ^(.+\.php)(.*)$; + fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; + fastcgi_param DOCUMENT_ROOT $realpath_root; + include /etc/nginx/fastcgi_params; +} +@endsection \ No newline at end of file diff --git a/storage/cache/887379cb96b8427d61aa39b73678b202900cb648.php b/storage/cache/887379cb96b8427d61aa39b73678b202900cb648.php new file mode 100644 index 0000000..cf09a80 --- /dev/null +++ b/storage/cache/887379cb96b8427d61aa39b73678b202900cb648.php @@ -0,0 +1,9 @@ +server_name ; + +# include snippets +include /etc/nginx/snippets/deny.conf; +include /etc/nginx/snippets/expires.conf; + +# logs +access_log /var/log/nginx/.access.log; +error_log /var/log/nginx/.error.log; \ No newline at end of file diff --git a/storage/cache/8f3a641a10e5f3da2806ddee53e0522e9158ee7b.php b/storage/cache/8f3a641a10e5f3da2806ddee53e0522e9158ee7b.php new file mode 100644 index 0000000..868921b --- /dev/null +++ b/storage/cache/8f3a641a10e5f3da2806ddee53e0522e9158ee7b.php @@ -0,0 +1,7 @@ +server { + location / { + try_files $uri $uri/ /index.php; + } +} + + \ No newline at end of file diff --git a/storage/cache/97f5c7f4e7eb0830bf2cbb7d8c98c9e7e3eda420.php b/storage/cache/97f5c7f4e7eb0830bf2cbb7d8c98c9e7e3eda420.php new file mode 100644 index 0000000..22e8da0 --- /dev/null +++ b/storage/cache/97f5c7f4e7eb0830bf2cbb7d8c98c9e7e3eda420.php @@ -0,0 +1,44 @@ +server { + listen 80; + listen [::]:80; + server_name www. ; + return 301 https://$request_uri; +} + + +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + + ssl_certificate /etc/letsencrypt/live/www./fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/www./privkey.pem; + + include snippets/ssl-params.conf; + include /etc/nginx/snippets/secure-headers.conf; + + server_name www.; + return 301 https://$request_uri; +} + + +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + + ssl_certificate /etc/letsencrypt/live//fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live//privkey.pem; + + add_header Content-Security-Policy " + default-src 'self'; + font-src 'self'; + style-src 'self'; + img-src 'self'; + base-uri 'self'; + form-action 'self'; + frame-ancestors 'self'; + "; + + make('partials.default', ['domain' => $domain], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> + + yieldContent('server'); ?> +} \ No newline at end of file diff --git a/storage/cache/b8be4cd44c7bf959a77084ac66540007a10ae7f2.php b/storage/cache/b8be4cd44c7bf959a77084ac66540007a10ae7f2.php new file mode 100644 index 0000000..61cbd7f --- /dev/null +++ b/storage/cache/b8be4cd44c7bf959a77084ac66540007a10ae7f2.php @@ -0,0 +1,44 @@ +startSection('server'); ?> +root ; +index ; + +# rewrite +location / { + try_files $uri $uri/ /index.php?$args; +} + +location = /favicon.ico { + log_not_found off; + access_log off; +} + +location = /robots.txt { + allow all; + log_not_found off; + access_log off; +} + +location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { + expires max; + log_not_found off; +} + +location ~ /\. { + deny all; +} + +location ~* /(?:uploads|files)/.*\.php$ { + deny all; +} + +# php-fpm configuration. +location ~ \.php(/|$) { + fastcgi_split_path_info ^(.+\.php)(.*)$; + fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; + fastcgi_param DOCUMENT_ROOT $realpath_root; + include /etc/nginx/fastcgi_params; +} +stopSection(); ?> +make($ssl ? 'layouts.ssl' : 'layouts.no-ssl', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> \ No newline at end of file diff --git a/storage/cache/c25fb649a0065d8271813d9667d51f50825d6579.php b/storage/cache/c25fb649a0065d8271813d9667d51f50825d6579.php new file mode 100644 index 0000000..3dc0259 --- /dev/null +++ b/storage/cache/c25fb649a0065d8271813d9667d51f50825d6579.php @@ -0,0 +1,16 @@ +server { + listen 80; + listen [::]:80; + server_name www. ; + return 301 http://$request_uri; +} + +server { + listen 80; + listen [::]:80; + + make('partials.default', ['domain' => $domain], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> + + startSection('server'); ?> + yieldSection(); ?> +} \ No newline at end of file diff --git a/storage/cache/d3faad602c007cdd0b7e6f2115872a4a74a46e03.php b/storage/cache/d3faad602c007cdd0b7e6f2115872a4a74a46e03.php new file mode 100644 index 0000000..a6c69de --- /dev/null +++ b/storage/cache/d3faad602c007cdd0b7e6f2115872a4a74a46e03.php @@ -0,0 +1,9 @@ +server_name ; + +# include snippets +include /etc/nginx/snippets/deny.conf; +include /etc/nginx/snippets/expires.conf; + +# logs +access_log /var/log/nginx/.access.log; +error_log /var/log/nginx/.error.log; \ No newline at end of file diff --git a/storage/cache/db33776c0af644e989accce92812804c9542ae25.php b/storage/cache/db33776c0af644e989accce92812804c9542ae25.php new file mode 100644 index 0000000..7916b86 --- /dev/null +++ b/storage/cache/db33776c0af644e989accce92812804c9542ae25.php @@ -0,0 +1,44 @@ +server { + listen 80; + listen [::]:80; + server_name www. ; + return 301 https://$request_uri; +} + + +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + + ssl_certificate /etc/letsencrypt/live/www./fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/www./privkey.pem; + + include snippets/ssl-params.conf; + include /etc/nginx/snippets/secure-headers.conf; + + server_name www.; + return 301 https://$request_uri; +} + + +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + + ssl_certificate /etc/letsencrypt/live//fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live//privkey.pem; + + add_header Content-Security-Policy " + default-src 'self'; + font-src 'self'; + style-src 'self'; + img-src 'self'; + base-uri 'self'; + form-action 'self'; + frame-ancestors 'self'; + "; + + make('partials.default', ['domain' => $domain], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> + + yieldContent('server'); ?> +} \ No newline at end of file diff --git a/storage/cache/ea3cb35f6a6aa916c3116d6254ed92e718b1cafb.php b/storage/cache/ea3cb35f6a6aa916c3116d6254ed92e718b1cafb.php new file mode 100644 index 0000000..853153a --- /dev/null +++ b/storage/cache/ea3cb35f6a6aa916c3116d6254ed92e718b1cafb.php @@ -0,0 +1,9 @@ +startSection('server'); ?> +root ; +index ; + +location / { + try_files $uri $uri/ /index.php; +} +stopSection(); ?> +make($ssl ? 'layouts.ssl' : 'layouts.no-ssl', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> \ No newline at end of file diff --git a/storage/cache/f759350e6c9ffc48e248d8248ac6e8cc234e8172.php b/storage/cache/f759350e6c9ffc48e248d8248ac6e8cc234e8172.php new file mode 100644 index 0000000..f228787 --- /dev/null +++ b/storage/cache/f759350e6c9ffc48e248d8248ac6e8cc234e8172.php @@ -0,0 +1,44 @@ +startSection('server'); ?> +root ; +index ; + +# rewrite +location / { + try_files $uri $uri/ /index.php?$args; +} + +location = /favicon.ico { + log_not_found off; + access_log off; +} + +location = /robots.txt { + allow all; + log_not_found off; + access_log off; +} + +location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { + expires max; + log_not_found off; +} + +location ~ /\. { + deny all; +} + +location ~* /(?:uploads|files)/.*\.php$ { + deny all; +} + +# php-fpm configuration. +location ~ \.php(/|$) { + fastcgi_split_path_info ^(.+\.php)(.*)$; + fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; + fastcgi_param DOCUMENT_ROOT $realpath_root; + include /etc/nginx/fastcgi_params; +} +stopSection(); ?> +make($ssl ? 'layouts.ssl' : 'layouts.no-ssl', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> \ No newline at end of file