I had trouble running a cron script using the following command after switching server for one of our websites.
|
1 |
Wget http://www.example.com/my_cron_script.php?q=param |
The website was hosted on a shared hosting at hostgator and it was working fine for long time. But after switching server to VPS, I started to get 403 errors whenever the cron script runs. After some research, I found out that mod_security is the one that is causing the trouble and there are three things you can do to solve the problem.
- Disable mod_security via .htaccess or uninstall it totally from your server
- Convert your script to curl
- White list your domain in mod_security configuration file
I think the best solution in terms of security is probably converting your script into curl but I chose option #3.
Here is what you need to add to white list your domain:
|
1 |
SecRule SERVER_NAME "example.com" phase:1,nolog,allow,ctl:ruleEngine=off |
You can add the line anywhere in mod_security’s configuration file. I added mine simply at the top.
Recent Comments