Nginx + ModSecurity and OWASP CRS

This tutorial shows how to install ModSecurity (open source web application Firewall) in Nginx, and also enable the OWASP ModSecurity Core Rule Set (CRS). Tested: Nginx Open Source 1.17.7 ModSecurity 3.0 OWASP ModSecurity CRS 3.2.2 Debian The official guide of installing ModSecurity for NGINX is very detail and well documented, and you should refer it. …

Read more

Nginx + WordPress, 404 errors for all pages?

We installed Nginx, MariaDB, PHP, and WordPress on Mac OS. The homepage is displayed fine, but all other pages are returning 404 errors? Tested with Nginx 1.17.9 WordPress 5.4 PHP 7.4 Review the current Nginx + WordPress integration. nginx.conf server { listen 8080; server_name localhost; root /usr/local/var/www/wordpress; location / { index index.html index.htm index.php; } …

Read more

Nginx + WordPress ERR_TOO_MANY_REDIRECTS

Fresh installs a WordPress on Windows for development, and hits the ERR_TOO_MANY_REDIRECTS error message? Tested URL : http://localhost/index.php/wp-admin/install.php Tested : PHP 7.1.10 WordPress 4.8.3 Nginx 1.12.1 MySQL 5.7.17 Windows 10 your-nginx\conf\nginx.conf upstream php { server 127.0.0.1:9999; } server { listen 80; server_name localhost; root www/wordpress; location / { try_files $uri $uri/ /index.php?$args; } location ~ …

Read more

PHP + Windows – Call to undefined function mysql_connect()

Install WordPress and hits the following error message : Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\nginx-1.12.1\www\wordpress\wp-includes\wp-db.php… Tested PHP 7.1.10 WordPress 4.8.3 Nginx 1.12.1 MySQL 5.7.17 Windows 10 Solution To install WordPress, PHP needs Mysql extension, to fix this, loads php_mysqli.dll in php.ini file. php.ini ; Directory in which the loadable extensions …

Read more

WordPress – Disable comments on attachments

After stopped and cleaned the WordPress pingback and trackback spams, those spammers have changed strategy to start spamming comments and trackbacks on the post attachments. Solution 1.1 Stop commenting on new and existing attachment. Add below PHP script in theme’s function.php ${theme_folder}/function.php //disable comments on attachment function filter_media_comment_status( $open, $post_id ) { $post = get_post( …

Read more

How to Stop WordPress Pingbacks and Trackbacks Spam

Review my WordPress wp_comments table and find out the file size is containing 500MB++ for around 1 millions++ comments! Dig inside and find out around 900k++ comments was marked as ‘trackback‘ and it linked back to a spammer’s website. The worst is the this type of ‘trackback‘ comments are kept increasing every second! Follow the …

Read more

ModSecurity exclude rules for editing posts and pages in WordPress

When editing post or page in WordPress, sometime the server’s firewall will block my IP address, and the log showed the following error: Terminal lfd: (mod_security) mod_security triggered by xx.xx.xx.xx : 5 in the last 300 secs The quick fix is to restart the modem or uses a VPN to get a new IP to …

Read more

JQuery is not working in wordpress – Solution

Since WordPress version 2.x, jQuery is a build-in Javascript library, explicitly include the jQuery library into WordPress is not necessary. Problem The jQuery is not working in WordPress plug-in writing? When you try to test a simple jQuery effect like following $(document).ready(function(){ alert(‘test’); }); It’s just not working, no alert message box pop up. The …

Read more