How to install apache in your home folder(i.e as a user) and use ssl for the same

 How to install apache in your home folder(i.e as a user) and use ssl for the same    
  1. Make a directory say "apache" in your home directory mkdir apache
  2. Copy the http tar file into the directory apache
  3. Untar the same in apache directory
    • cd apache
    • tar -xvf http-2.0.59.tar
    • This creates a folder "http-2.0.59" in apache directory
  4. Now follow following steps :
    • cd http-2.0.59

    • ./configure --prefix=/home/ajay/httpd/ --enable-ssl

    • make

    • make install


  5. The path for configuration file is
    /ajay/httpd/conf/httpd.conf
    Change the listening port(default is 80) to whatever port you like (But port number
    shd be greater than 1024)
  6. Now start the apache using the command
    • /httpd/bin/apachectl -k start
      • So now your apache server is ready to serve web pages .........




Now how to configure apache to use ssl
  1. Use following command to generate key and certificate files
    • openssl genrsa -out domainname.key 1024
    • openssl req -new -key domainname.key -out domainname.crt

    U can use anything in place of domainname but good practice is to use
    your domainname for which this certificate is going to use.
    ex: starcom.key, starcom.crt


  2. Now copy this files i.e domainname.key and domainname.crt in same secure place.
    For security reasons,it is strongly recommended that the file containing
    the private key be owned by "root" or "user" (who is installing apache in
    his home folder) and not generally readable(i.e. mode 400),
    and that the certificate be owned by "root" or "user" (who is installing apache
    in his home folder) and with no write permmisions.
    The certificate is public document(i.e it is given to any browser who connects
    to https://your-site) but the private key must remain a secret.


  3. Now for using this certificate to secure our document, we have to make changes in
    httpd.conf or vhosts.conf(in case of MercE)
    Ex:

    Listen 80
    Listen 4200

    <virtualHost starcomsoftware.com:4200>
    DocumentRoot .....
    ServerName .....
    SSLEngine On
    SSLCertificateFile <path of the certificate file>
    SSLCertificateKeyFile <path of the key file>
    .....


    Above example is just for testing.