Some usefull tips for Ubuntu

Actually, this is a note for myself, because I cannot remember a lot of things which only used when I setting up a new VPS.

1. Autocomplete not working in ubuntu:
There are 2 parts need to check. 1st, check package “bash-completion” installed or not.
2nd, open the file “/etc/bash.bashrc”, and find the lines below.

# enable bash completion in interactive shells
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion
fi

Uncomment those lines, if you don’t have them, add it in.

2.Stop nginx response to unknown domains:
Edit “/etc/nginx/nginx.conf”, add a server before it start to add servers from site-enabled folder.

server{
		listen 80 default_server;
		server_name	_;
		return	444;
	}
	include /etc/nginx/conf.d/*.conf;
	include /etc/nginx/sites-enabled/*;

3. About pptp VPN
Because I am using openvz, make sure turn ppp module before you install pptpd. Otherwise will need to use “apt-get –purgef” to remove all package and config files, and then start again.
Also, it seems ramnode.com restore /etc/network/interface to default after each restart. So you cannot use “pre-up” & “post-up” in that file to save and restore iptables rules. Alternatively, we can write 2 scripts in “/etc/network/if-post-down.d/iptablessave” & “/etc/network/if-pre-up.d/iptablesload” to save and reload the rules.