From 9629129772aad1421bb8703224c6b81e10d04f84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Sat, 2 Feb 2019 23:46:27 +0100 Subject: [PATCH] Use webroot instead of --nginx --- src/ServerConfigManagers/NginxConfigManager.php | 3 ++- src/ServerManager.php | 1 + src/config/tenancy.php | 6 +++++- tests/ServerManagerTest.php | 3 --- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ServerConfigManagers/NginxConfigManager.php b/src/ServerConfigManagers/NginxConfigManager.php index adf929b7..948a5b62 100644 --- a/src/ServerConfigManagers/NginxConfigManager.php +++ b/src/ServerConfigManagers/NginxConfigManager.php @@ -25,7 +25,8 @@ class NginxConfigManager implements ServerConfigManager $process = new Process(array_merge([ config('tenancy.server.certbot_path'), '-n', - '--nginx', + '--webroot', + '--webroot-path', config('tenancy.server.nginx.webroot'), '--agree-tos', '-d', $domain, '--preferred-challenges', 'http', diff --git a/src/ServerManager.php b/src/ServerManager.php index f922d676..8503823d 100644 --- a/src/ServerManager.php +++ b/src/ServerManager.php @@ -23,6 +23,7 @@ class ServerManager public function createVhost(string $domain) { + // todo symlink $this->serverConfigManager->addVhost($domain, $this->getConfigFilePath()); $this->serverConfigManager->deployCertificate($domain); if (method_exists($this->serverConfigManager, 'postCertDeploymentChanges')) { diff --git a/src/config/tenancy.php b/src/config/tenancy.php index 2a53f7cc..332c8aca 100644 --- a/src/config/tenancy.php +++ b/src/config/tenancy.php @@ -45,6 +45,7 @@ return [ */ ], 'nginx' => [ + 'webroot' => '/var/www/html', 'vhost' => " server { include includes/tenancy; @@ -52,7 +53,10 @@ return [ }", 'extra_certbot_args' => [ '--must-staple', - // '--staging', // obtains a fake cert intended for testing certbot + '--config-dir', '/etc/letsencrypt_tenancy', + '--work-dir', '/var/lib/letsencrypt_tenancy', + '--logs-dir', '/var/log/letsencrypt_tenancy', + '--staging', // obtains a fake cert intended for testing certbot // '--email', 'your@email', // if you haven't created an account in certbot yet ], ], diff --git a/tests/ServerManagerTest.php b/tests/ServerManagerTest.php index ac4da2a8..a4d999ea 100644 --- a/tests/ServerManagerTest.php +++ b/tests/ServerManagerTest.php @@ -61,9 +61,6 @@ class ServerManagerTest extends TestCase dump(fread($tmpfile, filesize($path))); // todo - // The following error was encountered:\n - // [Errno 13] Permission denied: '/var/log/letsencrypt/.certbot.lock'\n - // Either run as root, or set --config-dir, --work-dir, and --logs-dir to writeable paths.\n } public function setupCreateVhost()