Skip to content

Commit

Permalink
Merge pull request #2171 from OnlineDynamic/multisync-csp
Browse files Browse the repository at this point in the history
Improve apache config and config reload
  • Loading branch information
OnlineDynamic authored Feb 19, 2025
2 parents 2d30f9e + 16b0709 commit 51c7dc4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion etc/apache2.site
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ AddDefaultCharset utf-8
</IfModule>

# Pull in the Apache2 ContentPolicy
Include /opt/fpp/etc/apache2.csp
IncludeOptional /opt/fpp/etc/apache2.csp

<IfModule mod_headers.c>
# Set other security settings
Expand Down
25 changes: 21 additions & 4 deletions scripts/common
Original file line number Diff line number Diff line change
Expand Up @@ -201,18 +201,35 @@ setSetting() {
gracefullyReloadApacheConf() {
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
sudo apachectl graceful
if sudo apachectl -t >/dev/null 2>&1; then
sudo apachectl graceful
echo "Apache configuration reloaded successfully."
else
echo "Apache is not running."
return 1
fi
elif [[ -f /etc/debian_version ]]; then
# Debian/Ubuntu
sudo systemctl reload apache2
if systemctl is-active --quiet apache2; then
sudo systemctl reload apache2
echo "Apache configuration reloaded successfully."
else
echo "Apache is not running."
return 1
fi
elif [[ -f /etc/redhat-release ]]; then
# RHEL/CentOS/Fedora
sudo systemctl reload httpd
if systemctl is-active --quiet httpd; then
sudo systemctl reload httpd
echo "Apache configuration reloaded successfully."
else
echo "Apache is not running."
return 1
fi
else
echo "Unsupported OS"
return 1
fi
echo "Apache configuration reloaded successfully."
}

###################################################################
Expand Down

0 comments on commit 51c7dc4

Please sign in to comment.