Tuesday, September 6, 2011

Configure Apache on Solaris


Step by Step tutorial to Configure httpd.conf apache file .

Before reading this article be sure that your apache is running
 svcs -a | grep -i apache2

if the status is on-line you apache is running 
 online     11:37:06 svc:/network/http:apache2 

if the status is disable or something else read the following article 
 
### Notes ###
- httpd.conf file is a configuration file that contains all information (Directives) necessary  for apache server to run .
- Commonly , I use VI editor to edit and configure httpd.conf file , click here to learn more about VI editor ./////
- Apache is configured by placing directives in plain text configuration files.
- Before editing httpd.conf, make a copy the original file.

 Apache requires the following information for the DEFAULT HOST :

ServerName
ServerAdmin
DocumentRoot
Listen directive


ServerName
is a valid Domain Name Service (DNS) name that can be resolved by the system.
Example : www.yoursite.com

the steps To set the ServerName Directive in httpd.conf :-
at the command prompt type
 vi /etc/apache2/httpd.conf  
 
Vi editor will open the httpd.conf , search for the ServerName directive and change it to your site name .
 ServerName www.yoursite.com  

save and close the file .

ServerAdmin
the E-mail address of the web server administrator , this address shows up in error messages .

the steps to set the ServerAdmin Directive in hhtpd.conf
at the command prompt type
 vi /etc/apache2/httpd.conf 

Vi editor will open the httpd.conf , search for the serverAdmin directive and change it to the web server administrator.
 ServerAdmin you@yourhost.com  

 
save and close the file .

DocumentRoot
DocumentRoot is a directory where all your website files (HTML files) reside , the default location in Solaris 10 is /var/apache2/htdocs ,for example the server might receive a request for the following document :- www.yourwebsite.com/file.html , The server looks for the file in the default directory: /var/apache2/htdocs , you can change its value by editing httpd.conf .

Listen directive
The Listen directive tells the server to accept incoming requests only on the specified port or address-and-port combinations.

Examples : -

To make the server accept connections on ports 80 and 8888 change the Listen Directive in httpd.conf as follow :-
Listen 80  
Listen 8888 


To make the server accpet connectios on only port 8888 change the value of Listen Directive to be : -
 Listen 8888   

that means if the client request your web site just by its name ( www.site.com ) the request will be failed because the default Port is ( 80 ) and you have changed it to ( 8888 ) so , the client should request the site name plus the port number (www.site.com:8888) to get the correct response.
the default value for Listen Directive is :-  
Listen 80  



0 comments:

Post a Comment

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes