Skip to content

Commit d589a37

Browse files
authored
update script description
1 parent ae037a1 commit d589a37

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

fastcgi_ops_root.sh

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# Copyright (C) 2021 Hasan CALISIR <[email protected]>
3+
# Copyright (C) 2024 Hasan CALISIR <[email protected]>
44
# Distributed under the GNU General Public License, version 2.0.
55
#
66
# This program is free software: you can redistribute it and/or modify
@@ -18,15 +18,20 @@
1818

1919
# SCRIPT DESCRIPTION:
2020
#####################
21-
# This script manages Nginx FastCGI cache operations for WordPress websites running on Nginx.
2221
# This script is written for "FastCGI Cache Purge and Preload for Nginx" Wordpress Plugin.
23-
# It automates cache purging and preload tasks by monitoring changes in FastCGI cache
24-
# directories using inotifywait. Additionally, it sets up ACL permissions for PHP-FPM users,
25-
# ensuring they have necessary access for cache operations. The script also integrates with
26-
# systemd to manage a background service for continuous cache management.
27-
28-
# After you completed the setup (auto or manual) you can manage npp-wordpress systemd service
29-
# to start and stop inotifywait/setfacl operations for Nginx Cache Paths.
22+
# URL: https://wordpress.org/plugins/fastcgi-cache-purge-and-preload-nginx/
23+
# This script attempts to automatically match and grant (via setfacl) permissions for PHP-FPM-USER (as known, process owner or website-user) along with their associated Nginx Cache Paths.
24+
# If it cannot automatically match the PHP-FPM-USER along with their associated Nginx Cache Path, it offers an easy manual setup option with the 'manual-configs.nginx' file.
25+
# Mainly, in case your current web server setup involves two distinct users, WEBSERVER-USER (nginx or www-data) and PHP-FPM-USER,
26+
# the solution proposed by this script involves combining Linux server side tools 'inotifywait' with 'setfacl' to automatically grant write permissions to the PHP-FPM-USER
27+
# for the corresponding Nginx Cache Paths (listening cache events), which are matched either automatically or via a manual configuration file.
28+
# This approach is an alternative to external Nginx modules like Cache Purge module for purge operations.
29+
# This script create npp-wordpress sytemd service to manage grant permission for purge and preload actions.
30+
31+
# After completing the setup (whether automatic or manual), you can manage the automatically created
32+
# 'npp-wordpress' systemd service on the WP admin dashboard NPP plugin settings page.
33+
# This allows you to start and stop inotifywait/setfacl operations (via systemd) for Nginx Cache Path directly
34+
# from the front-end for associated PHP-FPM-USER
3035

3136
# Manual setup instructions
3237
manual_setup() {
@@ -237,7 +242,8 @@ find_create_includedir() {
237242
# By granting these permissions, the goal is to allow the 'npp-wordpress' systemd service to be controlled directly from the WordPress admin dashboard, enhancing operational flexibility and automation.
238243
# This automation enhances security by limiting sudo access to only specific systemd service management tasks.
239244
# After successful integration NPP users will be able to manage (start, stop, status) the 'npp-wordpress' systemd service on WP admin dashboard NPP plugin settings page.
240-
# This implementation not restrictly necessarry for functional cache purge & preload actions, but it is nice to have this ability that control main plugin systemd service 'npp-wordpress' on WP admin dashboard.
245+
# This implementation not restrictly necessarry for functional cache purge & preload actions and not breaks default setup process,
246+
# but it is nice to have this ability that control main plugin systemd service 'npp-wordpress' on WP admin dashboard.
241247
grant_sudo_perm_systemctl_for_php_process_owner() {
242248
# Try to get/create the includedir first
243249
if find_create_includedir; then
@@ -254,7 +260,7 @@ grant_sudo_perm_systemctl_for_php_process_owner() {
254260
return 1
255261
fi
256262

257-
# Check the integrity, checking main sudoers file is enough
263+
# Check the integrity, checking main sudoers file is enough it also checks the includedir paths
258264
if ! visudo -c -f "${SUDOERS_FILE}" > /dev/null 2>&1; then
259265
# Revert back changes
260266
rm "${includedir_path:?}/${NPP_SUDOERS:?}"

0 commit comments

Comments
 (0)