构建WEB服务器的三大组件安装apache2+php5+mysql5

+++++++++++++
mysql 安装:
$ tar zxvf mysql-5.0.41.tar.gz
$ cd mysql-5.0.41
# groupadd mysql          
# useradd -g mysql mysql  
# ./configure --prefix=/data/apps/mysql
# make
# make install
# cp support-files/my-medium.cnf /etc/my.cnf
# cd /data/apps/mysql
# bin/mysql_install_db --user=mysql
# chown -R root .
# chown -R mysql var
# chgrp -R mysql .
# bin/mysqld_safe --user=mysql &

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

apache 2 安装:

1、# Build and install apr 1.2
  # tar zxvf apr-1.2.9.tar.gz
# cd apr-1.2.9
#./configure --prefix=/data/apps/apr-httpd/
#make
#make install
2、# Build and install apr-util 1.2
# tar zxvf apr-util-1.2.8.tar.gz
# cd apr-util-1.2.8
# ./configure --prefix=/data/apps/apr-util-httpd /
> --with-apr=/data/apps/apr-httpd
#make
#make install
3、# Configure httpd

# tar jxvf httpd-2.2.4.tar.gz
# cd httpd-2.2.4
# vi config.sh 写入内容如下:
代码:

#!/bin/bash
HTTPD_ROOT="/data/apps/apache2"

./configure --prefix=$HTTPD_ROOT /
--with-apr=/data/apps/apr-httpd /
--with-apr-util=/data/apps/apr-util-httpd /
--enable-so /
--enable-rewrite /
--enable-info /
--enable-cgid /
--enable-mime-magic /
--enable-vhost-alias /
--enable-deflate /
--enable-expires /
--with-mpm=prefork

# sh config.sh
上面过程等同于直接
./configure --prefix=$HTTPD_ROOT /
--with-apr=/data/apps/apr-httpd /
--with-apr-util=/data/apps/apr-util-httpd /
--enable-so /
--enable-rewrite /
--enable-info /
--enable-cgid /
--enable-mime-magic /
--enable-vhost-alias /
--enable-deflate /
--enable-expires /
--with-mpm=prefork
# make
# make install  

+++++++++++++++++++++++++++++++++++++++++++++++++++++

安装php5
# tar jxvf php-5.2.3.tar.bz2
#cd php-5.2.3
$ vi config.sh 写入内容:
This extension is only available if PHP was configured with --enable-soap.
--enable-soap
代码:

#!/bin/bash
PHP_ROOT=/data/apps/php/
./configure --prefix=$PHP_ROOT /
            --with-apxs2=/data/apps/apache2/bin/apxs /
            --with-mysql=/data/apps/mysql /
            --enable-mbstring /
            --with-curl /
            --disable-debug /
            --enable-inline-optimization -q /
            --with-jpeg-dir=/usr/local/ /
            --with-png-dir /
            --enable-thread-safety /
            --enable-ctype /
            --with-bz2 /
            --with-zlib /
            --with-gd /
            --with-kerberos /
            --with-gettext /
            --enable-force-cgi-redirect /
            --with-iconv /
            --enable-gd-native-ttf /
            --enable-sockets /
            --with-snmp /
            --enable-ucd-snmp-hack
$sh config.sh
$ make
# make install
#cp php.ini-dist /data/apps/php/lib/php.ini

++++++++++++++++++++++++++++++++++++++++++++

基本配置

apache[/apache/conf/httpd.conf ]
修改
A. ServerAdmin webmaster@server.com
B. ServerName www.server.com:80

 
C. <Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all
</Directory>

D. <IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

E.  AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

F. 启用MPM、Virtual hosts
# Server-pool management (MPM specific)
Include conf/extra/httpd-mpm.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf

E.修改MPM、Virtual Hosts
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    ServerLimit         4000
    MaxClients          2000
    MaxRequestsPerChild   0
</IfModule>
<VirtualHost *:80>
    ServerAdmin webmaster@server.com
    DocumentRoot /data/webapps
    ServerName server.com
    ErrorLog logs/server.com-error_log
    CustomLog logs/server.com-access_log common
</VirtualHost>

测试:
在/apache2/htdocs 创建文件phpinfo.php 内容为:
代码:
<?php
echo phpinfo();
?>


在浏览器中打开 http://127.0.0.1/phpinfo.php 如果你能看到 phpinfo 界面那么ok。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值