From e721697ec5f8f34f390bb74c1e2c6849af030ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szekeres=20Ba=CC=81lint?= Date: Mon, 3 Sep 2018 22:53:56 +0200 Subject: [PATCH] Logging tab added support for domain specific acces_log / error_log (fixes #6) --- public/assets/js/app.js | 26 +++++- public/index.html | 93 ++++++++++++------- public/templates/conf/nginx.conf.html | 2 +- .../sites-available/example.com.conf.html | 18 +++- 4 files changed, 99 insertions(+), 40 deletions(-) diff --git a/public/assets/js/app.js b/public/assets/js/app.js index d2f7ce1..9d0c06c 100644 --- a/public/assets/js/app.js +++ b/public/assets/js/app.js @@ -72,8 +72,12 @@ worker_processes: 'auto', user: 'www-data', pid: '/run/nginx.pid', + access_log: '/var/log/nginx/access.log', - error_log: '/var/log/nginx/error.log', + error_log: '/var/log/nginx/error.log warn', + access_log_domain: false, + error_log_domain: false, + client_max_body_size: 16, gzip: true, server_tokens: false, @@ -161,6 +165,14 @@ return '/etc/nginx/ssl/' + $scope.domain() + '.key'; }; + $scope.accessLogDomainPath = function() { + return $scope.data.access_log.replace(/([^/]+)\.log$/, $scope.domain() + '.$1.log'); + }; + + $scope.errorLogDomainPath = function() { + return $scope.data.error_log.replace(/([^/]+)\.log (.+)$/, $scope.domain() + '.$1.log $2'); + }; + $scope.refreshHighlighting = function() { var sourceCodes = document.querySelectorAll('main .file .code.source'); @@ -431,6 +443,18 @@ return !!$scope.data.access_log; }; + $scope.isErrorLog = function() { + return !!$scope.data.error_log; + }; + + $scope.isAccessLogDomain = function() { + return $scope.data.access_log_domain; + }; + + $scope.isErrorLogDomain = function() { + return $scope.data.error_log_domain; + }; + $scope.isGzip = function() { return $scope.data.gzip; }; diff --git a/public/index.html b/public/index.html index 8d25d01..e4f23bd 100644 --- a/public/index.html +++ b/public/index.html @@ -57,6 +57,9 @@ + @@ -520,6 +523,63 @@ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ + +
+
+
+
-
- -
- -
-
-
- -
- -
-
-
- -
-
- - -
-
-
diff --git a/public/templates/conf/nginx.conf.html b/public/templates/conf/nginx.conf.html index e871236..b8354e4 100644 --- a/public/templates/conf/nginx.conf.html +++ b/public/templates/conf/nginx.conf.html @@ -28,7 +28,7 @@ http { # logging access_log {{ isAccessLog() ? data.access_log : 'off' }}; - error_log {{ data.error_log }} warn; diff --git a/public/templates/conf/sites-available/example.com.conf.html b/public/templates/conf/sites-available/example.com.conf.html index 21fc383..b34fb19 100644 --- a/public/templates/conf/sites-available/example.com.conf.html +++ b/public/templates/conf/sites-available/example.com.conf.html @@ -21,11 +21,6 @@ server { root /var/www/{{ domain() }}{{ data.document_root }}; - - # index.php - index index.php; # SSL @@ -35,6 +30,19 @@ server { ssl_trusted_certificate /etc/letsencrypt/live/{{ domain() }}/fullchain.pem; + + # logging + access_log {{ accessLogDomainPath() }}; + error_log {{ errorLogDomainPath() }}; + + # index.php + index index.php; # {{ isFallbackHTML() ? 'index.html' : ( isFallbackPHP() ? 'index.php' : '' ) }} fallback