ITƽ̨

RHEL6ϵͳLAMPƽ̨֮Apacheȫ

ߣqinbaoning008  ڣ2012-12-25 09:25:10
       LAMPܹĿǰΪһҵվӦģʽ֮һ,ָЭͬһϵͳ,ܹṩ̬WebվӦÿLAMPһд,Linuxϵͳ,Apacheվ,MySQLݿ,PHP(Perl,Python)ԡ
LAMPƽ̨ĸ,ÿһеһֹؼӦáҪ£
& LinuxΪLAMPܹеĻ,ṩ֧WebմIJϵͳƽ̨,ܹAMPṩõļ
& ApacheΪLAMPܹǰ,һǿȶWeb
&MySQLΪLAMPܹĺ,һеĿԴϵݿϵͳ
&PHP/Perl/PythonΪֿ̬ҳı,WebվеĶ̬ҳ沢ṩPHPһֱ㷺ӦõĿԴĶӵ½ű,Ƕ뵽HTML,ʺWebӦÿ

ΪϸRed Hat Enterprise Linux6ϵͳ밲װApacheIJã
Apacheڱ׼HTTPЭṩҳ,WebHTTPӦüЭ飬ҪڷֲʽЭϢϵͳHTTPЭͨõġ״̬ģϵͳĽʹ޹ءHTTPҲЭ飬ڸ񣬰ַ񡢷ֲʽ󷽷չȡInternetϣHTTPͨTCP/IPϣĬϵĶ˿Ϊ80Ҳʹ˿ڡApacheLinuxUNIXWindowsȶֲϵͳƽ̨СҪصԴ롢ƽ̨ʹáָ֧ҳԡģ黯ơȶõİȫԡApacheİװʽ֣RPMװͱ밲װΪRed Hat Enterprise Linux6ϵͳ밲װApacheIJã
Լȥȥhttp://httpd.apache.org/download.cgi µApacheԴ

һװ裺

1.ѹͷԴ
# tar -zxf httpd-2.4.2.tar.gz -C /usr/src/
# cd /usr/src/httpd-2.4.2/
2.ñѡпܱʧʾPCRE,ǿִyum install pcre* -y Ok
#./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --enable-ssl --with-ssl=/usr/lib --enable-auth-digest --enable-cgi --enable-suexec --with-suexec-caller=daemon --with-suexec-docroot=/usr/local/apache2/htdocs
3.
#make
4.װѱɵij
#make install

ã

1.õWeb
# vi /usr/local/apache2/conf/httpd.conf
ServerName www.it165.net:80
# /usr/local/apache2/bin/apachectl start
www.it165.net(߷ApacheIP),It works!ʾɹ
 

 

ApacheĬ:
# cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
# ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc5.d/S85httpd
# vi /etc/rc.d/init.d/httpd                   \\ע
# chkconfig: 345 85 15
# description: Apache
# chkconfig httpd on                               \\ڿͨserviceֹͣhttpd www.it165.net

2.Web

# cd /usr/local/apache2/conf/htdocs/
#mkdir 55linux yeacome
# echo "www.55linux.com" > 55linux/index.html
# echo "bbs.yeacome.com" > yeacome/index.html
# vi /usr/local/apache2/conf/httpd.conf
NameVirtualHost 220.194.52.154
<VirtualHost 220.194.52.154:80>
    DocumentRoot "/usr/local/apache2/htdocs/55linux"
    ServerName www.55linux.com
    ErrorLog "logs/www.55linux.com.error_log"
    CustomLog "logs/www.55linux.com.access_log" common
</VirtualHost>
<VirtualHost 220.194.52.154:80>
    DocumentRoot "/usr/local/apache2/htdocs/yeacome"
    ServerName bbs.yeacome.com
    ErrorLog "logs/bbs.yeacome.com.error_log"
    CustomLog "logs/bbs.yeacome.com.access_log" common
</VirtualHost>
,ڿͻзʲԣ
#service httpd restart

3.IPַ

# cd /usr/local/apache2/conf/htdocs/
#mkdir 55linux yeacome
# echo "www.55linux.com" > 55linux/index.html
# echo "bbs.yeacome.com" > yeacome/index.html
# vi /usr/local/apache2/conf/httpd.conf
<VirtualHost 220.194.52.158>
    DocumentRoot "/usr/local/apache2/htdocs/55linux"
    ServerName www.55linux.com
    ErrorLog "logs/www.55linux.com.error_log"
    CustomLog "logs/www.55linux.com.access_log" common
</VirtualHost>
<VirtualHost 220.194.52.157>
    DocumentRoot "/usr/local/apache2/htdocs/yeacome"
    ServerName bbs.yeacome.com
    ErrorLog "logs/bbs.yeacome.com.error_log"
    CustomLog "logs/bbs.yeacome.com.access_log" common
</VirtualHost>
,ڿͻзʲԣ
#service httpd restart

3.ڶ˿ڵ

# cd /usr/local/apache2/conf/htdocs/
#mkdir 55linux yeacome
# echo "www.55linux.com" > 55linux/index.html
# echo "bbs.yeacome.com" > yeacome/index.html
# vi /usr/local/apache2/conf/httpd.conf
Listen 220.194.52.158:80
Listen 220.194.52.158:8080
<VirtualHost 220.194.52.158::80>
    DocumentRoot "/usr/local/apache2/htdocs/55linux"
    ServerName www.55linux.com
    ErrorLog "logs/www.55linux.com.error_log"
    CustomLog "logs/www.55linux.com.access_log" common
</VirtualHost>
<VirtualHost 220.194.52.158:8080>
    DocumentRoot "/usr/local/apache2/htdocs/yeacome"
    ServerName bbs.yeacome.com
    ErrorLog "logs/bbs.yeacome.com.error_log"
    CustomLog "logs/bbs.yeacome.com.access_log" common
</VirtualHost>
,ڿͻзʲԣ
#service httpd restart
עͣе,ȥhttpd.confļ
#Include conf/extra/httpd-vhosts.conf        еע,Ȼеÿд/usr/local/apache2/conf/extra/httpd-vhosts.confļ,дhttpd.confļһ


4.ûĿ¼Ȩޣ

ļ
#htpasswd -c /usr/local/apache2/.htpasswd
û
#htpasswd /usr/local/apche2/.htpasswd 55linux
޸û
#htpasswd /usr/local/apche2/.htpasswd 55linux
Ŀ¼û֤
Alias /.htpasswd "/usr/local/mysecret“
<Directory "/usr/local/mysecret">
AuthType Basic
AuthName "This is a private directory. Please Login:"
AuthUserFile /usr/local/apche2/.htpasswd
Require valid-user 55linux
</Directory>
֤service httpd restart

httpdܣ

httpdԴһѹԹABApache BenchmarkڼWebմܱ֡ʹøʽ£
ab  [-q] -c  -n ܵ http://
ע⣺ָIJܴܵ


Tagǩ RHEL6   LAMP   Apache  
About IT165 - - ˽ - Ȩ - - վͼ - Ͷ - ϵʽ
վڻ,缼ѧϰ,ѧϰѭطɷ