Sunday 2 October 2011


Apache Server Installation and configurations



look if apache is installed

1.   rpm -qa | grep httpd

2.  rpm  -ql httpd-mannual

3  /etc/httpd
    /etc/httpd/conf
    /etc/http/conf.d


4. Apache startup
   httpd -> httpd.conf  & conf.d/*.conf
 

5. Apache logs
   /var/log/httpd
  /etc/httpd/logs


6. hostname -f

7. htdbm , htdigest , htpasswd ( Used to Password protect)

8. modules extend the capability of kernel. apache has modular structure

#$lsmod

9.  /var/www/
  html , cgi-bin , error , manual , icons ,usage




10. suexec " it runs cgi scripts" it is used by        apache.

11. virtual host
   
12. Listen 80 " Means When Apache starts it will bind to port 80"
 when Apache runs it temporarly run as root

13. Apache Model
    httpd(core key capabilities ) -> modules
      > grep Loadmodule httpd
 
11.  less /etc/passwd
       grep -i nologin /etc/passwd
       deamon users.
     
12. Document root "/var/www/html/"
      BUT It can be customized by changing as         below

    DocumentRoot "/var/www/testalias1"

13.  .htaccess

14. less /etc/mime type " Just Info "

15. Apache start

16. Alias " Allows us to map URLs to Physical Location

Alias /testalias/  "/var/www/testalias1 "
       testalis folder contains a file index.html.

user url  http://localhost/testalias/


17.  Directory Directive.
     
            Directory directive can accept many options to instruct Apache.
             Symlink should be created in document root ..... Use Alias directive

18 . Create Symbolic Link.
         ln -s ../testalias1/ testsymlink1.


19.Open Ports using  #system-config-securitylevel-gui/tui


20.  .htaccess file.
      
       #


21. Virtual Hosts.

      Allows apache to host multiple websites.

<VirtualHost>

</VirtualHost>

two types of virtual hosts, ip based and name based

IP Based Virtual Host

<VirtualHost 172.21.100.115:80 >
       ServerAdmin root@172.21.100.115
       DocumentRoot /var/www/ipbased_test
       ServerName abc.sngpl.com.pk
       DirctoryIndex xyz.html abc.html
       ErrorLog logs/ipbased_test.error.log
       CustomLog logs/ipbased_test.log combined
     
</VirtualHost>


Name Based Virtual Host



Virtual Hosts - IP-Based & Name Based



ApAche Basic Authentication


Apache DigestAuth

No comments:

Post a Comment