### Download and install one.sh script Source: https://gridpane.com/kb/optimus-cache-prime-cache-preloading Fetches the one.sh helper script and sets executable permissions. This script can monitor or abort ongoing preload jobs. ```bash cd /usr/local/bin/ocp wget https://cdn.pmylund.com/files/tools/one/one.sh chmod +x /usr/local/bin/ocp/one.sh ``` -------------------------------- ### Install Netdata via wget kickstart in Bash Source: https://gridpane.com/kb/how-to-setup-netdata-on-your-gridpane-servers Alternative method to download and run the Netdata kickstart script using wget. Requires wget, internet access, and sudo. Input: none. Output: Netdata installed. Limitations: Alternative to curl if unavailable. ```bash wget -O /tmp/netdata-kickstart.sh https://get.netdata.cloud/kickstart.sh && sh /tmp/netdata-kickstart.sh ``` -------------------------------- ### Download Optimus Cache Prime using wget Source: https://gridpane.com/kb/optimus-cache-prime-cache-preloading Retrieves the Optimus Cache Prime tar.gz archive to /usr/local/bin using wget. Requires network access and wget installed on the server. ```bash cd /usr/local/bin wget https://cdn.pmylund.com/files/tools/ocp2/linux/ocp-2.7-amd64.tar.gz ``` -------------------------------- ### Install Netdata via curl kickstart in Bash Source: https://gridpane.com/kb/how-to-setup-netdata-on-your-gridpane-servers Downloads and runs the Netdata kickstart script to install Netdata. Requires curl, internet access, and sudo. Input: none (script handles). Output: Netdata installed. Limitations: May fail without proper dependencies or if telemetry not disabled. ```bash bash <(curl -L -Ss https://my-netdata.io/kickstart.sh) ``` -------------------------------- ### Nginx HTTP Context Configuration Source: https://gridpane.com/kb/how-to-setup-shortpixel Example of an Nginx HTTP context configuration showing included files and directories for server-wide settings. ```Nginx http { include /etc/nginx/common/basics.conf; #include /etc/nginx/common/geoip.conf; include /etc/nginx/common/limits.conf; include /etc/nginx/mime.types; include /etc/nginx/common/ssl.conf; include /etc/nginx/common/logging.conf; include /etc/nginx/common/6g-mappings.conf; include /etc/nginx/conf.d/*.conf; include /etc/nginx/extra.d/http-context.conf; include /etc/nginx/sites-enabled/*; } ``` -------------------------------- ### Extract Optimus Cache Prime archive Source: https://gridpane.com/kb/optimus-cache-prime-cache-preloading Unpacks the downloaded tar.gz file using tar. Works on standard Unix-like systems with tar installed. ```bash tar -xf ocp-2.7-amd64.tar.gz ``` -------------------------------- ### Run Optimus Cache Prime preload command Source: https://gridpane.com/kb/optimus-cache-prime-cache-preloading Executes the ocp binary with your site's sitemap URL to preload the cache. Ensure the sitemap URL is reachable and the website is live. ```bash cd /usr/local/bin/ocp ./ocp https://yourwebsite.com/sitemap_index.xml ``` -------------------------------- ### Install BitNinja with Curl Command Source: https://gridpane.com/kb/bitninja-part-1 This command downloads and executes the BitNinja installation script from a provided URL. It requires root privileges and accepts a license key as an argument. The output shows the installation progress and success message. ```shell curl https://get.bitninja.io/install.sh | sudo /bin/bash -s - --license_key=XXXXXXXXXXXXXXX ``` -------------------------------- ### Permissions-Policy Example Source: https://gridpane.com/kb/how-to-create-a-content-security-policy-csp-header This example demonstrates a Permissions-Policy header configuration for Nginx. This header helps protect your site from third-party APIs and outdated functionalities. ```nginx add_header Permissions-Policy "camera=(), fullscreen=(self), geolocation=(), magnetometer=(), microphone=(), midi=(), payment=(), sync-xhr=(), usb=(), speaker-selection=()" ``` -------------------------------- ### Create webp-mappings.conf file via SSH Source: https://gridpane.com/kb/how-to-setup-shortpixel Command to create the webp-mappings.conf file in the /etc/nginx/conf.d/ directory using the nano editor. ```Bash nano /etc/nginx/conf.d/webp-mappings.conf ``` -------------------------------- ### Example of Swapping to Website System User Source: https://gridpane.com/kb/fortress-security-part-2-quick-start-configuration-guide Illustrates the command line prompt change after successfully switching to a website's system user using the 'su' command. This confirms the user context for running subsequent commands. ```bash root@myserver:/var/www/mywebsite.com/htdocs# **su testTEST38** **testTEST38@myserver**:/var/www/mywebsite.com/htdocs**$** ``` -------------------------------- ### Example Permissions-Policy Header Source: https://gridpane.com/kb/How-to-create-a-Content-Security-Policy-CSP-Header- This code snippet provides an example of a Permissions-Policy (formerly Feature-Policy) header, which controls browser access to various APIs. This is a starting point that should be customized based on your website's needs. ```nginx add_header Permissions-Policy \"camera=(), fullscreen=(self), geolocation=(), magnetometer=(), microphone=(), midi=(), payment=(), sync-xhr=(), usb=(), speaker-selection=()\" ``` -------------------------------- ### Install Maldet ClamAV GridPane Stack Source: https://gridpane.com/kb/an-introduction-to-maldet-and-clamav-malware-scanning Installs the combined Maldet and ClamAV malware scanning solution on GridPane servers. The installation includes automatic configuration of Maldet to use ClamAV engine and sets up daily automated scanning with dashboard notifications. Requires at least 2GB RAM and root SSH access. ```bash gp stack maldet -install ``` -------------------------------- ### Backup Database (Shell) Source: https://gridpane.com/kb/converting-myisam-to-innodb This command creates a backup of the entire database, including all tablespaces. Replace 'site.url' and 'mysystemuser' with your actual values. This command is crucial for data safety. ```shell gp wp **site.url **db export /var/www/**site.url**/htdocs/name_of_backup.sql --all-tablespaces --add-drop-table ``` -------------------------------- ### Navigate to Netdata config directory in Bash Source: https://gridpane.com/kb/how-to-setup-netdata-on-your-gridpane-servers Changes the current directory to the Netdata configuration folder. Input: path (hardcoded). Output: directory change. Limitations: Directory must exist after installation. ```bash cd /etc/netdata ``` -------------------------------- ### Clear Cache (Bash) Source: https://gridpane.com/kb/how-do-i-create-cronjobs Example cronjob to clear the cache for a specific site every 12 hours using GP WP-CLI. Demonstrates a practical use case for automated maintenance tasks. Requires GP WP-CLI to be installed and configured. ```bash 0 */12 * * * /usr/local/bin/gp fix cache example.com ``` -------------------------------- ### View site‑specific 7G configuration using Bash Source: https://gridpane.com/kb/using-the-7g-web-application-firewall Shows the site‑specific 7G configuration file, replacing **site.url** with the actual domain. Helps locate the include statements for custom rules. Run on the server with appropriate permissions. ```bash cat /etc/nginx/common/**site.url**-7g.conf ``` -------------------------------- ### Configure cron job for Optimus Cache Prime Source: https://gridpane.com/kb/optimus-cache-prime-cache-preloading Adds a crontab entry to run the ocp preload every 15 minutes. Adjust the schedule as needed; requires crontab access. ```bash crontab -e # Add the following line to the crontab: */15 * * * * /usr/local/bin/ocp/ocp https://yourwebsite.com/sitemap_index.xml ``` -------------------------------- ### Open nano editor for Nginx configuration file Source: https://gridpane.com/kb/making-nginx-accept-put-delete-and-patch-verbs Opens the nano text editor to create or edit the HTTP verbs configuration file. Replace example.com with your actual domain name before execution. ```bash nano /var/www/**example.com**/nginx/http-verbs-root-context.conf ``` ```bash nano /etc/nginx/extra.d/headers-http-context.conf ``` -------------------------------- ### Set Backup Schedule (GP-CLI) Source: https://gridpane.com/kb/transitioning-from-v1-backups-to-v2-backups This snippet explains how to set backup schedules for individual sites or all sites on a server using the `gpbup` command. Provides parameters for storage type, interval, minute, hour, and day. ```bash gpbup {your.site} -set-backup-schedule -storage {string} -backup-interval {interval} -minute {integer} -hour {integer} -day {day} ``` ```bash gpbup all-sites -set-backup-schedule -storage {string} -backup-interval {interval} -minute {integer} -hour {integer} -day {integer} ``` ```bash gpbup all-sites -set-backup-schedule -storage \"local\" -backup-interval \"monthly\" -minute \"30\" -hour \"2\" -day \"15\" ``` -------------------------------- ### Configure cron job for one.sh script Source: https://gridpane.com/kb/optimus-cache-prime-cache-preloading Sets up a crontab entry to run the one.sh helper alongside the ocp preload every 15 minutes, allowing monitoring or aborting of the preload process. ```bash crontab -e # Add the following line to the crontab: */15 * * * * /usr/local/bin/ocp/one.sh /usr/local/bin/ocp/ocp https://yourwebsite.com/sitemap_index.xml ```