You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ecommerce-applications/woocommerce/how-to-set-up-a-cron-job-for-wordpress-woocommerce-on-hypernode.md
+8-6Lines changed: 8 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,11 +11,13 @@ myst:
11
11
12
12
In this guide, we'll explain how to replace the default WordPress cron job with a cron job on your Hypernode server. This can be useful for low traffic sites, important tasks that need to be run at specific times, mitigating excessive DDoS attacks, or improving high page load times.
13
13
14
+
**Important note:** Access to wp-cron.php is blocked by default on Hypernode for security reasons. This is done to protect your server from potential DDoS attacks and unauthorized execution of scheduled tasks through the wp-cron.php endpoint. Setting up a proper server-side cron job as described in this guide allows you to safely run your WordPress scheduled tasks while maintaining the security benefits.
15
+
14
16
## Disable WordPress cron
15
17
16
18
To begin, disable the default WordPress cron by editing the wp-config.php file.
17
19
18
-
Connect to your server using an FTP client like FileZilla or an SSH client such as PuTTY. Navigate to the root directory of your WordPress installation and locate the `wp-config.php` file. Open the file for editing and add the following line of code before `/* That’s all. Stop editing! Happy blogging. */`:
20
+
Connect to your server using an FTP client like FileZilla or an SSH client such as PuTTY. Navigate to the root directory of your WordPress installation and locate the `wp-config.php` file. Open the file for editing and add the following line of code before `/* That's all. Stop editing! Happy blogging. */`:
Replace `https://yourdomain.hypernode.io` with the actual URL of your WordPress site.
42
+
**Note:** Make sure to replace `/data/web/public/wp-cron.php` with the actual path to your WordPress installation if it's different from the default path. The default WordPress installation path on Hypernode is typically `/data/web/public/`.
41
43
42
-
Explanation of the Cron Job Command
44
+
### Explanation of the Cron Job Command
43
45
44
46
-`* * * * *`: Specifies the interval for the cron job. In this case, it is set to run every minute. You can adjust this based on your needs.
45
-
-`wget -q -O - 'https://yourdomain.hypernode.io/wp-cron.php?doing_wp_cron'`: Uses wget to make a web request to the WordPress cron URL, triggering any scheduled tasks.
46
-
-`>/dev/null 2>&1`: Discards any output from the command, preventing it from filling up your server logs.
47
+
-`php /data/web/public/wp-cron.php`: Directly executes the WordPress cron script using PHP, eliminating the need for an HTTP request.
48
+
-`>/dev/null 2>&1`: Discards any output from the command, preventing it from filling up your server logs.
47
49
48
50
After setting up your cron job, monitor your WordPress site to ensure that scheduled tasks are being executed as expected. This setup ensures that your WordPress or WooCommerce site on Hypernode handles scheduled tasks more reliably, especially under conditions where the default cron system may not suffice.
0 commit comments