I love Free Software!

Pages

Funny Quotes to Think

When you say "I wrote a program that crashed Windows", people just stare at You blankly and say "Hey, I got those with the system, for free"

-Torvalds, Linus(1995-03-08)-

Friday, January 29, 2010

Reset MySql Password

Follow below steps for reseting mysql password in Debian linux
  • Login to server as root
  • kill mysql server pid. In debain you can find pid file in /var/run/mysqld
kill `cat /var/run/mysqld/mysqld.pid`
  • Create a text file and add below sql statements to text file. Change 'password' to new password required
UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
FLUSH PRIVILEGES; 
  • Start mysql server with --init-file option 
mysqld_safe --init-file=/path/to/textfile &

Now login to mysql using new password

Friday, January 1, 2010

How to access any web application server running on different port with apache http (port 80)

Apache can handle any web server application which running on different port using its own http port
Apache uses mod_proxy to implement a proxy/cache for Apache. It implements proxying capability for FTP, CONNECT (for SSL), HTTP/0.9, HTTP/1.0, and (as of Apache 1.3.23) HTTP/1.1. The module can be configured to connect to other proxy modules for these and other protocols.

Imagine you have a webserver application running 5566. You need to access this application using apcache port 80. You can follow this steps
  • Install proxy modules for apache, if it is not installed  
# aptitude install libapache2-mod-proxy-html
  • Enable proxy modules for apache
Change to directory /etc/apache2/mods-available and enable module
 # a2enmod proxy

Reload apache service
# invoke-rc.d apache2 reload
  • Create a new apache virtual host to access web server application using mod_proxy
Here is I am including a virtualhost configuration to access a webserver  which running on port 5566 using apache port 80

<VirtualHost *:80>
         ServerName example.org
          ServerAlias www.example.org
          ProxyRequests Off
        <Proxy *>
          Order deny,allow
          Allow from all
        </Proxy>

          ProxyPass / http://localhost:5566/
          ProxyPassReverse / http://localhost:5566/
        <Location />
          Order allow,deny
          Allow from all
        </Location>
      </VirtualHost>