From c54bc33b6b14e259845b5822516e861df2fdb621 Mon Sep 17 00:00:00 2001 From: Joby Elliott Date: Tue, 22 Oct 2024 21:02:36 -0600 Subject: [PATCH] bug fix --- install/nginx-log-format.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/install/nginx-log-format.sh b/install/nginx-log-format.sh index 90a2936..3c03c3b 100644 --- a/install/nginx-log-format.sh +++ b/install/nginx-log-format.sh @@ -1,9 +1,7 @@ #!/bin/bash -# Define the log format -LOG_FORMAT='log_format domain_combined '\''$host $remote_addr - $remote_user [$time_local] '\ -''\"$request\" $status $body_bytes_sent '\ -''\"$http_referer\" \"$http_user_agent\"'\'';' +# Define the log format (all on one line) +LOG_FORMAT='log_format domain_combined '\''$host $remote_addr - $remote_user [$time_local] "\"$request\"" $status $body_bytes_sent "\"$http_referer\"" "\"$http_user_agent\""'\'';' # Check if we're root if [ "$EUID" -ne 0 ]; then @@ -12,7 +10,10 @@ if [ "$EUID" -ne 0 ]; then fi # Backup the original config -cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak +if ! cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak; then + echo "Failed to create backup" + exit 1 +fi # Check if format already exists if grep -q "log_format domain_combined" /etc/nginx/nginx.conf; then