You can view iptables entries by line with command:
iptables -L INPUT -n --line-numbers

root@tests:~# iptables -L INPUT -n –line-numbers
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination
1    ACCEPT     tcp  —         tcp dpt:22
2   ACCEPT     tcp  —         tcp dpt:80
3    ACCEPT     tcp  —         tcp dpt:443
4    ACCEPT     tcp  —         tcp dpt:21
5   ACCEPT     all  —  
6   ACCEPT     all  —
7   ACCEPT     icmp —  
8   ACCEPT     all  —
9   DROP       all  —             state NE

You’ll get the list of all INPUT entries.  Look at the number on the left  then use the following command to delete :

iptables -D INPUT <<number here>>


This is my favorite and I think the more simple  if you want permanent redirect  from NON WWW to WWW insert the following code in the nginx configuration file nginx.conf :

server {
  listen 80;
  rewrite ^/(.*)$$1 permanent;
Permanent redirect from WWW to NON WWW in nginx, use this code in your nginx.conf :
server {
  listen 80;
  rewrite ^/(.*)$$1 permanent;


To reset the MySQL root password, login to the mysql shell and run the following commands:

SET PASSWORD FOR root@localhost=PASSWORD('RootPasswordHere');

Apache2 is one of the most widely used HTTP server has a lot of features and can be customized in many ways.

In fact, to this web server, there are basically two ways you can do this, using .htaccess directives or using a file httpd.conf. .

Some people prefer to use. htaccess files, since they reside in the website and can be modified by the site owner, which is not the case for the daemon configuration file:


Permanent redirect  NON WWW to WWW using apache2 server configuration:
RedirectMatch permanent ^/(.*)$1
DocumentRoot /path/to/your/site/files/

You can run this command to strip the comments (line that begins with a #) and remove blank lines from a file in Linux :

cat /path/to/file  | grep -v ^# | grep -v ^$


To remove comment lines from squid.conf you can run the following command:

cat /etc/squid/squid.conf | grep -v ^# | grep -v ^$ > squid_stripped.conf

Page 3 of 41234