Daily Archives: March 18, 2015

WooCommerce can’t remove items from cart on Nginx

Just finished moving client site from Apache to Nginx, and upon testing I noticed when I try to remove some product from the cart, it wasn’t working . All is happening is to reload the page.

It turns out that the problem is in my Nginx config (as I suspected).

A really simple fix.

If you have section like this in your config file:

    location / {
                try_files $uri $uri/ /index.php;
        }

you will need to add ?$args after index.php, so it is going to look like this:

    location / {
                try_files $uri $uri/ /index.php?$args;
        }

Check the number of active connections on port 80

If you want to quickly check the number of the active connections on your server you can run this command:

netstat -anp | grep :80 | grep ESTABLISHED | wc -l

Don’t forget the semi-colon.
This will work also for all other ports for example SSH on the default 22, or HTTPS on 443.

And this one will list the number of the active connections per IP sorted

netstat -ntu | grep :80 | grep -v LISTEN | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -rn