Build three components of the WEB server and install apache2 + php5 + mysql5

Source: Internet
Author: User
++ Mysql installation: $tarzxvfmysql-5.0.41.tar.gz $ cdmysql-5.0.41 # groupaddmysql # useradd-gmysqlmysql #. configure -- prefixdata1_mysql # make # makeinstall # cpsupport-filesmy-medium.cnfetcmy.cnf # cddataapps

++ Mysql installation: $ tar zxvf mysql-5.0.41.tar.gz $ cd mysql-5.0.41 # groupadd mysql # useradd-g mysql #. /configure -- prefix =/data/apps/mysql # make install # cp support-files/my-medium.cnf/etc/my. cnf # cd/data/apps

++
Mysql installation:
$ Tar zxvf mysql-5.0.41.tar.gz
$ Mysql-5.0.41 cd
# Groupadd mysql
# Useradd-g 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 &

++ ++

Install 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:
Code:

#! /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
The above process is equivalent to direct
./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

++ ++

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
Code:

#! /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

++ ++

Basic Configuration

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


C.
Options FollowSymLinks
AllowOverride None
Order deny, allow
Allow from all

D.
DirectoryIndex index.html index. php

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. Enable MPM and Virtual hosts
# Server-pool management (MPM specific)
Include conf/extra/httpd-mpm.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf

E. Modify MPM and Virtual Hosts

StartServers 5
MinSpareServers 5
MaxSpareServers 10
ServerLimit 4000
MaxClients 2000
MaxRequestsPerChild 0


ServerAdmin webmaster@server.com
DocumentRoot/data/webapps
ServerName server.com
ErrorLog logs/server.com-error_log
CustomLog logs/server.com-access_log common

Test:
The phpinfo. php file created in/apache2/htdocs is as follows:
Code:
Echo phpinfo ();
?>


Open http: // 127.0.0.1/phpinfo. php In the browser. If you can see the phpinfo interface, click OK.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.