06 Web Server
Si funksionon web serveri?
Procesi i ndezjes se Appache
Ne momentin e ndezjes appache lexon disa skedare konfigurimi:
/etc/httpd/conf/httpd.conf , i cili eshte skedari kryesor i konfirgurimit te appache
/etc/mime.types , ku lexon typet e skedareve dhe prapashtesat e tyre
Pas trajtimit te konfigurimeve qe gjen ne keto skedare, procesi baze i appache qe ka si pronar root ngre nje ose disa procese bir qe jane ne pronesi te perdoruesit apache. Jane keto procese bir te cilat degjojne per kerkesa http ne porten 80 dhe i trajtojne ato.
Apache eshte shume i parametrizuar, ndaj mund te pranoje shume konfigurime, gje qe vertetohet edhe nga numri i madh i direktivave te konfigurimit disponibel (http://httpd.apache.org/docs/2.2/mod/directives.html ).
Disa nga direktivat kane te bejne me parametrizimin e menyres se trajtimit te apache nga sistemi operativ, disa direktiva jane per te garantuar kompatibilitet me versionet e meparshme ndersa disa direktiva perdoren ve raste te vecanta.
Skedari httpd.conf
Direktivat e konfigurimit t ne skedarin httpd.conf jane te organizuara ne tre seksione:
seksioni i pare percakton parametrat globale te apache
seksioni i dyte percakton parametrat e konfigurimit te serverit web primar ose default ( qe i pergjigjet te gjitha kerkesave qe nuk trajtohen nga hostet virtuale)
Seksioni i trete percakton parametrat e konfigurimit te hosteve virtuale
Konfigurimi i parametrave globale te apache
ServerRoot "/etc/httpd"
Percakton direktorine rrenje per skedaret e konfigurimit dhe te log te apache
PidFile run/httpd.pid
Percakton skedarin qe ruan PID e procesit master te apache
Shembull:
[root@localhost student]# cat /etc/httpd/run/httpd.pid
4001
[root@localhost student]#
Te tjere parametra globale konfigurimi
Nje konfigurim shembull i parametrave globale do te ishte:
Konfigurimi i serverit baze (default)
Tabelat me poshte listojne parametrat e konfigurimit te serverit baze
Direktiva UserDir
Each user can be permitted to have a web site in their home directory using the UserDir directive.
Visitors to a URL http://example.com/~username/ will get content out of the home directory of the user "username", out of the subdirectory specified by the UserDir directive.
The UserDir directive specifies a directory out of which per-user content is loaded. This directive may take several different forms:
1
If a path is given which does not start with a leading slash, it is assumed to be a directory path relative to the home directory of the specified user. Given this configuration:
UserDir public_html
the URL http://example.com/~rbowen/file.html will be translated to the file path /home/rbowen/public_html/file.html
2
If a path is given starting with a slash, a directory path will be constructed using that path, plus the username specified. Given this configuration:
UserDir /var/html
the URL http://example.com/~rbowen/file.html will be translated to the file path /var/html/rbowen/file.html
3
f a path is provided which contains an asterisk (*), a path is used in which the asterisk is replaced with the username. Given this configuration:
UserDir /var/www/*/docs
the URL http://example.com/~rbowen/file.html will be translated to the file path /var/www/rbowen/docs/file.html
Direktiva HostnameLookups
Syntax:
HostnameLookups On|Off|Double
This directive enables DNS lookups so that host names can be logged (and passed to CGIs/SSIs in REMOTE_HOST).
The value Double refers to doing double-reverse DNS lookup.
That is, after a reverse lookup is performed, a forward lookup is then performed on that result.
At least one of the IP addresses in the forward lookup must match the original address.
The default is Off in order to save the network traffic for those sites that don't truly need the reverse lookups done.
It is also better for the end users because they don't have to suffer the extra latency that a lookup entails. Heavily loaded sites should leave this directive Off, since DNS lookups can take considerable amounts of time.
Konfigurim i i hosteve virtuale
Parametrat kryesore te konfigurimit te hosteve virtuale
Shembull i nje hosti virtual
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.endri.com
ServerAlias endri.com *.endri.com
DocumentRoot /var/www/endri.com/
</VirtualHost>