Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve apache config and config reload #2171

Merged
merged 2 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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