Snippets

Postfix Delete Mail Queue on Debian Squeeze

To delete the Postfix mail queue use the following command:

root@deb:~# postsuper -d ALL
postsuper: Deleted: 5 messages
root@deb:~#

You can also use man postsuper command for more options.


Apache2 List all Loaded Modules on Debian Squeeze

Use the following command:

apache2ctl -M

The output will look like this:

root@debian:~# apache2ctl -M
Loaded Modules:
core_module (static)
log_config_module (static)
logio_module (static)
mpm_worker_module (static)
http_module (static)
so_module (static)
actions_module (shared)
alias_module (shared)
auth_basic_module (shared)
authn_file_module (shared)
authz_default_module (shared)
authz_groupfile_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgi_module (shared)
cgid_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
mime_module (shared)
negotiation_module (shared)
reqtimeout_module (shared)
rewrite_module (shared)
rpaf_module (shared)
setenvif_module (shared)
status_module (shared)
Syntax OK
root@debian:~#


Easy way to delete rule from iptables

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

root@tests:~# iptables -L INPUT -n –line-numbers
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination
1    ACCEPT     tcp  –  0.0.0.0/0            192.168.1.100       tcp dpt:22
2   ACCEPT     tcp  –  0.0.0.0/0            192.168.1.100       tcp dpt:80
3    ACCEPT     tcp  –  0.0.0.0/0            192.168.1.100       tcp dpt:443
4    ACCEPT     tcp  –  0.0.0.0/0            192.168.1.100       tcp dpt:21
5   ACCEPT     all  –  127.0.0.1            0.0.0.0/0
6   ACCEPT     all  –  192.168.1.100        0.0.0.0/0
7   ACCEPT     icmp –  0.0.0.0/0            0.0.0.0/0
8   ACCEPT     all  –  192.168.4.0/24       0.0.0.0/0
9   DROP       all  –  0.0.0.0/0            0.0.0.0/0           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>>

Enjoy.


301 Permanent Redirect NON WWW to WWW and viceversa on Nginx

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;
  server_name www.debian-tutorials.com;
  rewrite ^/(.*)$ http://debian-tutorials.com/$1 permanent;
}
Permanent redirect from WWW to NON WWW in nginx, use this code in your nginx.conf :
server {
  listen 80;
  server_name debian-tutorials.com;
  rewrite ^/(.*)$ http://www.debian-tutorials.com/$1 permanent;
}

Enjoy!


Snippet: How To Set MySQL root password

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

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




Categories

Page 1 of 3123
Copyright © 2012 Linux Debian Tutorials | Debian Squeeze Tutorials. All rights reserved.
Stop ACTA