Posts

Showing posts from April, 2008

Apache: Proxy and ReverseProxy Server

Redirect your all traffic: Case: example.com A record is point to server with IP10.1.31.7 (mean its resolves to IP 10.1.31.7 ), but you are running your web server from example.com on server with IP 10.1.31.8. So, you want all traffic coming to 10.1.31.7 will redirect to 10.1.31.8. Do the following changes on server have IP 10.1.31.7 : 1. Run apache . 2. Do the following entry in apache. a. NameVirtualHost 10.1.31.7 b <VirtualHost 10.1.31.7:80 > ServerName example.com ServerAlias www.example.com DocumentRoot /home/test ProxyRequests off ProxyPass / http://www.example.com/ ProxyPassReverse / http://www.example.com/ <Location /> ProxyPassReverse / </Location> </VirtualHost> 3. Do the following entry in /etc/hosts. 10.1.31.8 example.com 10.1.31.8 www.example.com ( make sure once you #ping example.com from 10.1.31.7 it resolver's to 10.1.31.8 ). Note: its redirect only http request not https. more you can see on this link

Removing all blank lines, leading and trailing blank spaces

Removing all blank lines, leading and trailing blank spaces : #sed '/^$/d; s/^[ ]*//g; s/[ ]*$//g' prabhat.txt > kumar.txt This command will create new file (kumar.txt) on which it removes blank lines, leading and trailing blank spaces.

Changing Run Levels

On production environment normal run level 3 is used and it get rarely changed. Runlevel and usage : 0 — Halt 1 — Single-user mode 2 — Not used (user-definable) 3 — Full multi-user mode 4 — Not used (user-definable) 5 — Full multi-user mode (with an X-based login screen) 6 — Reboot Check run level using :- # who -r or # runlevel Change run level using:- # telinit 5 or open file # emacs /etc/inittab Look for the default runlevel called initdefault which look like as follows: id: 3 :initdefault: Replace run level x with y ( where x is current run level and y you want to set ). Set services in run level using : # ntsysv or # chkconfig or # serviceconf

How To: Transfer your PuTTY settings between computers

Putty stores its settings in the Windows registry. To save a backup of your Putty settings, you'll need to export this registry key to a file. HKEY_CURRENT_USER\Software\SimonTatham Steps : 1. Click Start->Run and type "RegEdt32" in the "Open" dialog. Click "Ok" 2. One RegEdt32 starts, you'll be presented with an application. 3. Press "Ctrl+F" to bring up the Find dialog. Enter the name of the key, "SimonTratham" in the "Find What" field, and make sure only "Keys" is checked in the "Look At" section of the dialog. Finally, click "Find Next" 4. The search may take a while, reminding us that the Windows Registry is a large and mysterious place where dragons be. Let's use these few seconds to reflect on the fact that you should never, ever, never change things in the registry unless you are absolutely, positively, totally, completely, 100% dead sure that you know exactly what you'r