Configuration of Apache Server to Support PHP and Perl and MySQL
My full book is in http://www.lulu.com/content/347251, I will show some part from it which is related to some case study,
Case Study:
We should install Apache HTTP server package httpd, httpd-devel, httpd-manual, and the php RPMS and the mysql RPMS and the perl RPMS from the RedHat distribution.
This is a quick case study, to show how to create a web server that can be utilized in our system.
1. I suppose to create a web server that will host www.mtit.gcc.gov.ps and www.mot.gcc.gov.ps.
2. I created the DNS names www.mtit.gcc.gov.ps and www.mot.gcc.gov.ps that point to our web server IP address 10.12.1.252
3. I created two users motuser and mtituser
4. I put the two miniseries web pages in /home/motuser and /home/mtituser with the proper permissions.
5. I created two virtual hosts in the following way in the httpd.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerName linux1.localdomain.msft
DocumentRoot /var/www/html/
</VirtualHost>
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.mtit.gcc.gov.ps
DocumentRoot /home/mtituser
Options Includes, Indexes
</VirtualHost>
<VirtualHost *:80>
ServerName www.mot.gcc.gov.ps
DocumentRoot /home/motuser
</VirtualHost>
<Directory /home/motuser>
Options Includes FollowSymLinks Indexes
AllowOverride none
</Directory>
<Directory /home/motuser>
Options Includes FollowSymLinks Indexes
AllowOverride none
XBitHack on
</Directory>
<Directory /var/www/html>
Options Includes FollowSymLinks Indexes
AllowOverride none
XBitHack on
</Directory>
By this the shtml web pages will be parsed for SSI and also any html page that
is set to be executable.
6. To make sure the cgi-bin will execute the perl program, add
ScriptAlias \cgi-bin\ "\var\www\cgi-bin\"
7. To allow CGI program execution for any file ending in .cgi in any directory, ie, user directory, you can use the following configuration.
<Directory /home/*>
Options +ExecCGI
AddHandler cgi-script .cgi
</Directory>
8. To allow peruser access, we can put in the home hirectory of each user, e.g. sana, a directory public_html which include sana web page, and we put in the httpd.conf
UserDir enabled
UserDir public_html
So we can get the web page of sana by http://linux1.localdomain.msft/~sana/
9. Testing the authentication and .htaccess as mentioned in the previous sections, things succeeded in Windows but not in Linux. The Linux did not accept the password
htpasswd -c /root/passwords hedaya (then password)
<Directory /home/motuser>
Options Includes FollowSymLinks Indexes
AllowOverride AuthConfig Options
XBitHack on
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /root/passwords
Require user hedaya
</Directory>
10. As final, we shall start httpd and mysqld, by
service httpd restart , service mysqld restart
My full book is in http://www.lulu.com/content/347251
My Email Address: [email protected]