Centos 6.5 配置分离式LAMP平台环境 多服务器编译安装Apache2.4.x PHP5.4.x MariaDB5.5.x

这次LAMP环境才去多服务器方式,apache部署在一台服务器上 PHP部署在一台服务器上 MariaDB部署在一台服务器上。
测试OS:Centos 6.5 x86_64
软件版本:apache 2.4.x php5.4.x MariaDB 5.5.x
网络环境:

[[email protected] ~]# ifconfig eth0 | awk -F‘[ :]+‘ ‘/inet addr/{print$4}‘
172.16.41.163   ###httpd服务器

[[email protected] ~]# ifconfig eth0 | awk -F‘[ :]+‘ ‘/inet addr/{print$4}‘
172.16.41.164   ###php服务器

[[email protected] ~]# ifconfig eth0 | awk -F‘[ :]+‘ ‘/inet addr/{print$4}‘
172.16.41.165   ###mysql服务器

一、部署httpd服务器

1、编译安装apache

[[email protected] ~]# yum groupinstall "Development tools" -y
[[email protected] ~]# yum groupinstall "Server Platform Development" -y
[[email protected] ~]# yum install pcre-devel vim tree screen htop -y
[[email protected] ~]# tar xf apr-1.5.1.tar.gz
[[email protected] ~]# tar xf apr-util-1.5.3.tar.bz2
[[email protected] ~]# cd apr-1.5.1
[[email protected] apr-1.5.1]# ./configure --prefix=/usr/local/apr151
[[email protected] apr-1.5.1]# make -j4 && make install
[[email protected] apr-1.5.1]# cd ../apr-util-1.5.3
[[email protected] apr-util-1.5.3]# ./configure --prefix=/usr/local/aprutil153 --with-apr=/usr/local/apr151/
[[email protected] apr-util-1.5.3]# make -j4 && make install && cd ~
[[email protected] ~]# tar xf httpd-2.4.10.tar.bz2
[[email protected] ~]# cd httpd-2.4.10
[[email protected] httpd-2.4.10]# ./configure --prefix=/usr/local/apache2410 --sysconfdir=/etc/httpd2410 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr151/ --with-apr-util=/usr/local/aprutil153/ --enable-mpms-shared=all --with-mpm=event --enable-modules=most
[[email protected] httpd-2.4.10]# make -j4 && make install && cd ~
[[email protected] ~]# echo "export PATH=/usr/local/apache2410/bin/:\$PATH" > /etc/profile.d/apache2410.sh
[[email protected] ~]# sed -i "$(cat /etc/man.config | grep -nE ‘^MANPATH[[:space:]]+‘ | tail -1 | awk -F: ‘{print$1}‘)a \MANPATH\tMANPATH /usr/local/apache2410/man" /etc/man.config
[[email protected] ~]# ln -s /usr/local/apache2410/include/ /usr/include/apache

2、配置httpd下面是/etc/httpd2410/httpd.conf 配置文件内容

[[email protected] ~]# httpdDir="/etc/httpd2410/httpd.conf"
[[email protected] ~]# sed -ri ‘[email protected](^[[:space:]]+DirectoryIndex)( index.html)@\1 index.php\[email protected]‘ $httpdDir
##上一行命令是在 DirectoryIndex index.html行中添加一个index.php

[[email protected] ~]# sed -ri "/$(grep -E "^[[:space:]]+AddType" $httpdDir | tail -1 | sed ‘[email protected]/@\\&@‘)/a \\\tAddType application/x-httpd-php .php" !$
##在配置文件中添加 AddType application/x-httpd-php .php

[[email protected] ~]# sed -ri "/$(grep -E "^[[:space:]]+AddType" $httpdDir | tail -1 | sed ‘[email protected]/@\\&@‘)/a \\\tAddType application/x-httpd-php-source .phps" !$
##在配置文件中添加 AddType application/x-httpd-php-source .phps

[[email protected] ~]# sed -i "[email protected]^ServerRoot .*@#&@" !$
##这一条命令视情况是否执行,如果后面创建虚拟机主机就执行吧,作用是取消 ServerRoot行的配置

[[email protected] ~]# sed -i "/^Listen 80/a \#Listen 443" !$
##这条命令可以忽视

[[email protected] ~]# sed -ri "[email protected]^#(Include /etc/httpd2410/extra/httpd-vhosts.conf)@\[email protected]" !$
##这条是启动虚拟机主机并指定虚拟主机配置文件为 /etc/httpd2410/extra/httpd-vhosts.conf(配置文件是编译安装apache默认的位置,不建议修改)

[[email protected] ~]# sed -ri "[email protected]^#(Include /etc/httpd2410/extra/httpd-ssl.conf)@\[email protected]" !$
##启用SSL功能 指定SSL配置文件在/etc/httpd2410/extra/httpd-ssl.conf(配置文件是编译安装apache默认的位置,不建议修改)

[[email protected] ~]# sed -ri "[email protected]^#(LoadModule ssl_module modules/mod_ssl.so)@\[email protected]" !$
##启用SSL模块

[[email protected] ~]# sed -ri "[email protected]^#(LoadModule socache_shmcb_module modules/mod_socache_shmcb.so)@\[email protected]" !$
##启用socache_shmcb模块

[[email protected] ~]# sed -ri "[email protected]^#(LoadModule proxy_module .*)@\[email protected]" !$
##启用proxy_module模块

[[email protected] ~]# sed -ri "[email protected]^#(LoadModule proxy_fcgi_module.*)@\[email protected]" !$
##启用proxy_fcgi_module模块

[[email protected] ~]# sed -ri "[email protected]^#(LoadModule rewrite_module modules/mod_rewrite.so)@\[email protected]" !$
##启用rewrite_module模块

[[email protected] ~]# ####sed -i "/^DocumentRoot.*/a \ProxyPassMatch ^/(.*\.php)$ fcgi://172.16.41.164:9000/home/wwwroot/www.05hd.com\$1" !$
[[email protected] ~]# ####sed -i "/^DocumentRoot.*/a \ProxyRequests Off" !$
####上面两行配置文件修改的命令根据自己的情况看是否执行,
####如果apache不创建虚拟主机那么就必须要执行,如果创建虚拟机主机就根据自己实际情况来确认是否执行

[[email protected] ~]# sed -i "[email protected]^DocumentRoot.*@#&@" !$
##上面这一行命令 视情况是否执行,如果后面需要创建虚拟主机就必须执行,否则必须不执行

[[email protected] ~]# sed -i "[email protected]^PidFile.*@PidFile "/usr/local/apache2410/logs/httpd.pid"@" !$
##修改pid文件路径

[[email protected] ~]# grep ‘^[^#]‘ $httpdDir | grep -vE ‘^[[:space:]]+#‘
PidFile /usr/local/apache2410/logs/httpd.pid
Listen 80
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_socache_module modules/mod_authn_socache.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule reqtimeout_module modules/mod_reqtimeout.so
LoadModule filter_module modules/mod_filter.so
LoadModule mime_module modules/mod_mime.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule env_module modules/mod_env.so
LoadModule headers_module modules/mod_headers.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule mpm_event_module modules/mod_mpm_event.so
LoadModule unixd_module modules/mod_unixd.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule dir_module modules/mod_dir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so

User daemon
Group daemon

ServerAdmin [email protected]
ServerName LookBack163.05hd.com:80

    AllowOverride none
    Require all denied

    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted

    DirectoryIndex index.php index.html

    Require all denied

ErrorLog "logs/error_log"
LogLevel warn

    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

    CustomLog "logs/access_log" common

    ScriptAlias /cgi-bin/ "/usr/local/apache2410/cgi-bin/"

    AllowOverride None
    Options None
    Require all granted

    TypesConfig /etc/httpd2410/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
	AddType application/x-httpd-php .php
	AddType application/x-httpd-php-source .phps

Include /etc/httpd2410/extra/httpd-vhosts.conf
Include /etc/httpd2410/extra/httpd-default.conf

Include /etc/httpd2410/extra/proxy-html.conf

Include /etc/httpd2410/extra/httpd-ssl.conf

SSLRandomSeed startup builtin
SSLRandomSeed connect builtin

3、制作httpd启动脚本第一种方法:(推荐)

[[email protected] ~]# for I in $(ps -aux | grep [h]ttp |awk ‘{print$2}‘); do kill -9 $I;done
[[email protected] ~]# for I in $(ps -aux | grep [a]pache |awk ‘{print$2}‘); do kill -9 $I;done
###上2行的命令是强制结束所有httpd的进程
[[email protected] ~]# [ -f /etc/init.d/httpd ] && mv /etc/init.d/httpd /etc/init.d/httpd.bak
[[email protected] ~]# cp /usr/local/apache2410/bin/apachectl /etc/init.d/httpd
[[email protected] ~]# sed -i ‘/#!\/bin\/sh/a \# chkconfig: 35 85 15\n# description: Activates\/Deactivates Apache 2.4.10‘ /etc/init.d/httpd
[[email protected] ~]# chmod +x /etc/rc.d/init.d/httpd2410
[[email protected] ~]# chkconfig --add httpd
[[email protected] ~]# chkconfig --list httpd
httpd          	0:off	1:off	2:off	3:off	4:off	5:off	6:off
[[email protected] ~]# chkconfig httpd on
[[email protected] ~]# chkconfig --list httpd
httpd          	0:off	1:off	2:on	3:on	4:on	5:on	6:off

第二种方法:

[[email protected] ~]# for I in $(ps -aux | grep [h]ttp |awk ‘{print$2}‘); do kill -9 $I;done
[[email protected] ~]# for I in $(ps -aux | grep [a]pache |awk ‘{print$2}‘); do kill -9 $I;done
[[email protected] ~]# [ -f /etc/init.d/httpd ] && mv /etc/init.d/httpd /etc/init.d/httpd.bak
[[email protected] ~]# wget -c4 -O /etc/rc.d/init.d/httpd2410 "http://www.05hd.com/httpd.sh"
[[email protected] ~]# chmod +x /etc/rc.d/init.d/httpd2410
[[email protected] ~]# sed -ri "[email protected]^# chkconfig.*@# chkconfig: 2345 85 15\n# Default-Start:  2 3 4 5\n# Default-Stop: 0 1 [email protected]" /etc/rc.d/init.d/httpd2410
[[email protected] ~]# sed -ri "[email protected]^pidfile=.*@pidfile=\${PIDFILE-/usr/local/apache2410/logs/httpd.pid222}@" /etc/rc.d/init.d/httpd2410
[[email protected] ~]# sed -ri "[email protected]^apachectl=.*@apachectl=/usr/local/apache2410/bin/[email protected]" /etc/rc.d/init.d/httpd2410
[[email protected] ~]# sed -ri "[email protected]^httpd=.*@httpd=\${HTTPD-/usr/local/apache2410/bin/httpd}@" /etc/rc.d/init.d/httpd2410
[[email protected] ~]# chkconfig --add httpd
[[email protected] ~]# chkconfig --list httpd
httpd          	0:off	1:off	2:off	3:off	4:off	5:off	6:off
[[email protected] ~]# chkconfig httpd on
[[email protected] ~]# chkconfig --list httpd
httpd          	0:off	1:off	2:on	3:on	4:on	5:on	6:off
###下面是启动脚本的源码
#!/bin/bash
#
# httpd        Startup script for the Apache HTTP Server
#
# chkconfig: 2345 85 15
# Default-Start:  2 3 4 5
# Default-Stop: 0 1 6
# description: The Apache HTTP Server is an efficient and extensible  #	       server implementing the current HTTP standards.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /usr/local/apache2410/logs/httpd.pid
#
### BEGIN INIT INFO
# Provides: httpd
# Required-Start: $local_fs $remote_fs $network $named
# Required-Stop: $local_fs $remote_fs $network
# Should-Start: distcache
# Short-Description: start and stop Apache HTTP Server
# Description: The Apache HTTP Server is an extensible server
#  implementing the current HTTP standards.
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

#if [ -f /etc/sysconfig/httpd ]; then
#        . /etc/sysconfig/httpd
#fi

# Start httpd in the C locale by default.
HTTPD_LANG=${HTTPD_LANG-"C"}

# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""

# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
# with the thread-based "worker" MPM; BE WARNED that some modules may not
# work correctly with a thread-based MPM; notably PHP will refuse to start.

# Path to the apachectl script, server binary, and short-form for messages.
#apachectl=/usr/sbin/apachectl
apachectl=/usr/local/apache2410/bin/apachectl
httpd=${HTTPD-/usr/local/apache2410/bin/httpd}
prog=httpd
pidfile=${PIDFILE-/usr/local/apache2410/logs/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0
STOP_TIMEOUT=${STOP_TIMEOUT-10}

# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure.  So we just do it the way init scripts
# are expected to behave here.
start() {
        echo -n $"Starting $prog: "
        LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && touch ${lockfile}
        return $RETVAL
}

# When stopping httpd, a delay (of default 10 second) is required
# before SIGKILLing the httpd parent; this gives enough time for the
# httpd parent to SIGKILL any errant children.
stop() {
	echo -n $"Stopping $prog: "
	killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd
	RETVAL=$?
	echo
	[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
    echo -n $"Reloading $prog: "
    if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
        RETVAL=6
        echo $"not reloading due to configuration syntax error"
        failure $"not reloading $httpd due to configuration syntax error"
    else
        # Force LSB behaviour from killproc
        LSB=1 killproc -p ${pidfile} $httpd -HUP
        RETVAL=$?
        if [ $RETVAL -eq 7 ]; then
            failure $"httpd shutdown"
        fi
    fi
    echo
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  status)
        status -p ${pidfile} $httpd
	RETVAL=$?
	;;
  restart)
	stop
	start
	;;
  condrestart|try-restart)
	if status -p ${pidfile} $httpd >&/dev/null; then
		stop
		start
	fi
	;;
  force-reload|reload)
        reload
	;;
  graceful|help|configtest|fullstatus)
	$apachectl [email protected]
	RETVAL=$?
	;;
  *)
	echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}"
	RETVAL=2
esac

exit $RETVAL

二、配置MariaDB服务器

1、配置一个LV逻辑分区

[[email protected] ~]# fdisk /dev/sda &> /dev/null > /etc/fstab
[[email protected] ~]# mount -a
[[email protected] ~]# mount
/dev/mapper/vg0-root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
/dev/mapper/vg0-usr on /usr type ext4 (rw)
/dev/mapper/vg0-var on /var type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/mapper/MYDATA-MYDATAlv on /MYSQLDATA type ext4 (rw)
[[email protected] ~]# df -h
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/vg0-root          20G  924M   18G   5% /
tmpfs                        935M     0  935M   0% /dev/shm
/dev/sda1                    194M   35M  150M  19% /boot
/dev/mapper/vg0-usr          9.9G  2.4G  7.1G  26% /usr
/dev/mapper/vg0-var           20G  433M   19G   3% /var
/dev/mapper/MYDATA-MYDATAlv   20G  172M   19G   1% /MYSQLDATA

用于MariaDB数据存放的LV分区已经做好了 并且做了开机自动挂载2、配置MariaDB

[[email protected] ~]# groupadd -r mysql
[[email protected] ~]# mkdir /MYSQLDATA/data
[[email protected] ~]# useradd -g mysql -r -s /sbin/nologin -M -d /MYSQLDATA/data mysql
[[email protected] ~]# chown -R mysql:mysql /MYSQLDATA/data/
[[email protected] ~]# wget http://mirrors.hustunique.com/mariadb/mariadb-galera-5.5.38/bintar-centos5-amd64/mariadb-galera-5.5.38-linux-x86_64.tar.gz
[[email protected] ~]# tar xf mariadb-galera-5.5.38-linux-x86_64.tar.gz -C /usr/local
[[email protected] ~]# cd /usr/local/
[[email protected] local]# ls
bin  etc  games  glibc-2.19  include  lib  lib64  libexec  mariadb-galera-5.5.38-linux-x86_64  sbin  share  src
[[email protected] local]# ln -sv mariadb-galera-5.5.38-linux-x86_64/ mariadb
`mariadb‘ -> `mariadb-galera-5.5.38-linux-x86_64/‘   ###`
[[email protected] local]# cd mariadb
[[email protected] mariadb]# chown -R mysql:mysql .

3、初始化MariaDB

[[email protected] mariadb]# pwd
/usr/local/mariadb
[[email protected] mariadb]# scripts/mysql_install_db --user=mysql --datadir=/MYSQLDATA/data/
WARNING: The host ‘LookBack165.05hd.com‘ could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MariaDB version. The MariaDB daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MariaDB privileges !
Installing MariaDB/MySQL system tables in ‘/MYSQLDATA/data/‘ ...
140813 11:46:44 [Note] WSREP: Read nil XID from storage engines, skipping position init
140813 11:46:44 [Note] WSREP: wsrep_load(): loading provider library ‘none‘
140813 11:46:44 [Note] [Debug] WSREP: dummy_init
140813 11:46:45 [Note] [Debug] WSREP: dummy_disconnect
140813 11:46:45 [Note] WSREP: Service disconnected.
140813 11:46:46 [Note] WSREP: Some threads may fail to exit.
140813 11:46:46 [Note] [Debug] WSREP: dummy_free
OK
Filling help tables...
140813 11:46:46 [Note] WSREP: Read nil XID from storage engines, skipping position init
140813 11:46:46 [Note] WSREP: wsrep_load(): loading provider library ‘none‘
140813 11:46:46 [Note] [Debug] WSREP: dummy_init
140813 11:46:46 [Note] [Debug] WSREP: dummy_disconnect
140813 11:46:46 [Note] WSREP: Service disconnected.
140813 11:46:47 [Note] WSREP: Some threads may fail to exit.
140813 11:46:47 [Note] [Debug] WSREP: dummy_free
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:

‘./bin/mysqladmin‘ -u root password ‘new-password‘
‘./bin/mysqladmin‘ -u root -h LookBack165.05hd.com password ‘new-password‘

Alternatively you can run:
‘./bin/mysql_secure_installation‘

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.

You can start the MariaDB daemon with:
cd ‘.‘ ; ./bin/mysqld_safe --datadir=‘/MYSQLDATA/data/‘

You can test the MariaDB daemon with mysql-test-run.pl
cd ‘./mysql-test‘ ; perl mysql-test-run.pl

Please report any problems at http://mariadb.org/jira

The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Support MariaDB development by buying support/new features from
SkySQL Ab. You can contact us about this at [email protected]
Alternatively consider joining our community based development effort:
http://mariadb.com/kb/en/contributing-to-the-mariadb-project/

[[email protected] mariadb]# chown -R root  .
[[email protected] mariadb]# ls -l
total 244
drwxr-xr-x  2 root mysql   4096 Jun 25 12:57 bin
-rw-r--r--  1 root mysql  17987 Jun 23 22:14 COPYING
-rw-r--r--  1 root mysql  26545 Jun 23 22:13 COPYING.LESSER
drwxr-xr-x  3 root mysql   4096 Jun 25 12:56 data
drwxr-xr-x  2 root mysql   4096 Jun 25 12:57 docs
-rw-r--r--  1 root mysql   8245 Jun 23 22:13 EXCEPTIONS-CLIENT
drwxr-xr-x  3 root mysql   4096 Jun 25 12:57 include
-rw-r--r--  1 root mysql   8694 Jun 23 22:13 INSTALL-BINARY
drwxr-xr-x  3 root mysql   4096 Jun 25 12:57 lib
drwxr-xr-x  4 root mysql   4096 Jun 25 12:56 man
drwxr-xr-x 11 root mysql   4096 Jun 25 12:57 mysql-test
-rw-r--r--  1 root mysql 110472 Jun 23 22:13 README
-rw-r--r--  1 root mysql  19510 Jun 23 22:13 README-wsrep
drwxr-xr-x  2 root mysql   4096 Jun 25 12:57 scripts
drwxr-xr-x 27 root mysql   4096 Jun 25 12:57 share
drwxr-xr-x  4 root mysql   4096 Jun 25 12:57 sql-bench
drwxr-xr-x  3 root mysql   4096 Jun 25 12:56 support-files

4、编辑MariaDB配置文件

[[email protected] mariadb]# cd /usr/local/mariadb
[[email protected] mariadb]# cp support-files/my-large.cnf  /etc/my.cnf

###并修改此文件中thread_concurrency的值为你的CPU个数乘以2,比如这里使用如下行:
thread_concurrency = 2
###[[email protected] mariadb]# sed -i "@^thread_concurrency.*@thread_concurrency = [email protected]" /etc/my.cnf###也可以用这个命令直接修改
[[email protected] mariadb]# sed -i "/^thread_concurrency.*/i \datadir = \/MYSQLDATA\/data" /etc/my.cnf

5、配置MariaDB启动脚本等其他配置

[[email protected] mariadb]# cp /usr/local/mariadb/support-files/mysql.server  /etc/rc.d/init.d/mysql
[[email protected] mariadb]# chmod +x /etc/rc.d/init.d/mysql
[[email protected] mariadb]# chkconfig --add mysql
[[email protected] mariadb]# chkconfig --list mysql
mariadb        	0:off	1:off	2:on	3:on	4:on	5:on	6:off
[[email protected] mariadb]# sed -i ‘[email protected]/usr/local/[email protected]/usr/local/[email protected]‘ /etc/rc.d/init.d/mysql
[[email protected] mariadb]# service mysql start
Starting MySQL.....                                        [  OK  ]
[[email protected] mariadb]# service mysql stop
Shutting down MySQL.                                       [  OK  ]
[[email protected] mariadb]# sed -i "$(cat /etc/man.config | grep -nE ‘^MANPATH[[:space:]]+‘ | tail -1 | awk -F: ‘{print$1}‘)a MANPATH\t/usr/local/mariadb/man" /etc/man.config
[[email protected] mariadb]# ln -sv /usr/local/mariadb/include  /usr/include/mysql
[[email protected] mariadb]# echo ‘/usr/local/mariadb/lib/‘ > /etc/ld.so.conf.d/mysql.conf
[[email protected] mariadb]# ldconfig
[[email protected] mariadb]# echo "export PATH=/usr/local/mariadb/bin:$PATH" > /etc/profile.d/mariadb5538.sh

三、配置php服务器

1、下载和编译php

[[email protected] ~]# wget http://www.05hd.com/wp-content/uploads/2014/08/php-5.4.31.tar.bz2
[[email protected] ~]# yum groupinstall "Development tools" -y && yum groupinstall "Server Platform Development" -y
[[email protected] ~]# yum install libxml2 libxml2-devel libmcrypt bzip2 bzip2-devel libmcrypt-devel mhash-devel mhash pcre-devel vim tree screen htop -y
[[email protected] ~]# for i in libxml2 bzip2 libmcrypt pcre mhash; do rpm -qa |grep "$i";done
libxml2-2.7.6-14.el6.x86_64
libxml2-python-2.7.6-14.el6.x86_64
libxml2-devel-2.7.6-14.el6.x86_64
bzip2-libs-1.0.5-7.el6_0.x86_64
bzip2-1.0.5-7.el6_0.x86_64
bzip2-devel-1.0.5-7.el6_0.x86_64
libmcrypt-devel-2.5.8-9.el6.x86_64
libmcrypt-2.5.8-9.el6.x86_64
pcre-devel-7.8-6.el6.x86_64
pcre-7.8-6.el6.x86_64
mhash-devel-0.9.9.9-3.el6.x86_64
mhash-0.9.9.9-3.el6.x86_64
[[email protected] ~]# cd php-5.4.31
[[email protected] php-5.4.31]# ./configure --prefix=/usr/local/php --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-openssl --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml  --enable-sockets --with-mcrypt --enable-fpm  --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2  --enable-maintainer-zts
[[email protected] php-5.4.31]# make -j4 && make install
###编译参数解释
-prefix=/usr/local/PHP           php 安装目录
--with-apxs2=/usr/local/apache/bin/apxs
--with-config-file-path=/usr/local/PHP/etc   指定php.ini位置
--with-mysql=/usr/local/mysql   mysql安装目录,对mysql的支持
--with-mysqli=/usr/local/mysql/bin/mysql_config    mysql高级访问接口
--with-openssl ;可以支持ssl
--enable-mbstring ;启动多字节字符支持
--with-freetype-dir ;这是让PHP支持GD库的配置选项
--with-jpeg-dir
--with-png-dir
--with-zlib;支持zlib的压缩库
--with-libxml-dir=/usr
--enable-xml ;支持xml格式
--enable-sockets;支持socket方式通信
--with-apxs2=/usr/local/apache/bin/apxs;php针对此接口来编译进apache
--with-mcrypt;支持加密工具
--with-config-file-path=/etc;配置文件文件
--with-config-file-scan-dir=/etc/php.d;找/etc/php.d/下一.ini结尾的文件作为配置文件
--with-bz2
--enable-maintainer-zts;如果MPM为event和worker模型,编译时此处须启用,如果为prefork,它是以mod_php的方式安装的。

2、配置php

[[email protected] php-5.4.31]# cp php.ini-production /etc/php.ini
[[email protected] php-5.4.31]# cp sapi/fpm/init.d.php-fpm.in /etc/rc.d/init.d/php-fpm
[[email protected] php-5.4.31]# chmod +x /etc/rc.d/init.d/php-fpm
[[email protected] php-5.4.31]# chkconfig --add php-fpm
[[email protected] php-5.4.31]# chkconfig --list php-fpm
php-fpm        	0:off	1:off	2:on	3:on	4:on	5:on	6:off
[[email protected] php-5.4.31]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
[[email protected] php-5.4.31]# sed -i ‘[email protected]^pm.max_children.*@pm.max_children = [email protected];[email protected]^pm.start_servers.*@pm.start_servers = [email protected];[email protected]^pm.min_spare_servers.*@pm.min_spare_servers = [email protected];[email protected]^pm.max_spare_servers.*@pm.max_spare_servers = [email protected];[email protected];pid = .*@pid = /usr/local/php/var/run/[email protected]‘ /usr/local/php/etc/php-fpm.conf
[[email protected] php-5.4.31]# sed -i "[email protected]^listen.*@listen = $(ifconfig eth0 | awk -F‘[ :]+‘ ‘/inet addr/{print$4}‘):[email protected]" /usr/local/php/etc/php-fpm.conf
[[email protected] php-5.4.31]# cat /usr/local/php/etc/php-fpm.conf | grep -vE ‘^;|^[[:space:]]{0,}$‘
[global]
pid = /usr/local/php/var/run/php-fpm.pid
[www]
user = nobody
group = nobody
listen = 172.16.41.164:9000
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 2
pm.max_spare_servers = 8
[[email protected] php-5.4.31]# mkdir -p /home/wwwroot/www.05hd.com
[[email protected] php-5.4.31]# chmod 755 !$
chmod 755 /home/wwwroot/www.05hd.com

下面来启动php-fpm

[[email protected] php-5.4.31]# service php-fpm start
Starting php-fpm  done
[[email protected] php-5.4.31]# ss -tnlp


四、配置具体的web服务

1、配置httpd服务器上虚拟机1.1下面是我的虚拟机配置

[[email protected] ~]# grep ‘^[^#]‘ /etc/httpd2410/extra/httpd-vhosts.conf | grep -vE ‘^[[:space:]]+#‘ServerAdmin [email protected]
    ServerName www1.05hd.com
    DocumentRoot "/web/hosta"
    ProxyRequests Off
    ProxyPassMatch ^/(.*.php)$ fcgi://172.16.41.164:9000/home/wwwroot/www.05hd.com/$1Require all grantedSetHandler server-status
        Require all grantedErrorLog "logs/www1.05hd.com-error_log"
    CustomLog "logs/www1.05hd.com-access_log" commonServerAdmin [email protected]
    ServerName pam.05hd.com
    DocumentRoot "/web/hosta"
    ProxyRequests Off
    ProxyPassMatch ^/(.*.php)$ fcgi://172.16.41.164:9000/home/wwwroot/phpmyadmin/$1
    ErrorLog "logs/pam.05hd.com-error_log"
    CustomLog "logs/pam.05hd.com-access_log" commonRequire all granted

1.2我们再去php服务器上弄个测试页面看看效果

[[email protected] php-5.4.31]# cat > /home/wwwroot/www.05hd.com/index.php << EOFIt works! This Is A Test Page
EOF

再来看看status页面的情况看到这个页面的时候就说明httpd服务器配置OK httpd服务器上虚拟机配置OK php服务器配置OK httpd服务器通过代理的方式让php服务器处理php页面配置OK2、下面我们去MariaDB服务器上做一些配置2.1MariaDB用户创建1、修改root默认空密码为YTJmZjQ5NThiMGNl
2、新建一个可在172.16.41.164连接的root用户 密码为YTJmZjQ5NThiMGNl,且拥有整个MariaDB的全部权限(不推荐使用,这里是在局域网上进行的测试,所以无所谓。)

[[email protected] ~]# service mysql start
Starting MySQL....                                         [  OK  ]
[[email protected] ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.38-MariaDB-wsrep-log MariaDB Server, wsrep_25.10.r3997

Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

MariaDB [(none)]> use mysql
Database changed
MariaDB [mysql]> update user set password=password(‘YTJmZjQ5NThiMGNl‘) where user=‘root‘;
Query OK, 4 rows affected (0.07 sec)
Rows matched: 4  Changed: 4  Warnings: 0

MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT ALL ON *.* TO ‘root‘@‘172.16.41.164‘ IDENTIFIED BY ‘YTJmZjQ5NThiMGNl‘;
Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> \q
Bye
###这里将MariaDB root的密码修改成了YTJmZjQ5NThiMGNl,并且让172.16.41.164服务器有权限连接使用

如果感觉使用root用户不安全可以使用下面的方法
1、修改root默认空密码为YTJmZjQ5NThiMGNl
2、创建一个新用户wpblog 并创建一个与新用户同名的数据库,此用户拥有这个同名数据库的全部权限且设置密码为YTJmZjQ5NThiMGNl,此MariaDB用户只允许来自172.16.41.164的连接

mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.38-MariaDB-wsrep-log MariaDB Server, wsrep_25.10.r3997

Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

MariaDB [(none)]> use mysql
Database changed
MariaDB [mysql]> update user set password=password(‘YTJmZjQ5NThiMGNl‘) where user=‘root‘;
Query OK, 4 rows affected (0.07 sec)
Rows matched: 4  Changed: 4  Warnings: 0

MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> CREATE USER ‘wpblog‘@‘172.16.41.164‘ IDENTIFIED BY ‘YTJmZjQ5NThiMGNl‘;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT USAGE ON *.* TO ‘wpblog‘@‘172.16.41.164‘ IDENTIFIED BY ‘***‘ WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;CREATE DATABASE IF NOT EXISTS `wpblog`;
Query OK, 0 rows affected (0.00 sec)

Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON `wpblog`.* TO ‘wpblog‘@‘172.16.41.164‘;GRANT ALL PRIVILEGES ON `wpblog\_%`.* TO ‘wpblog‘@‘172.16.41.164‘;
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> \q
Bye

3、下面我们去httpd服务器上配置用于phpmyadmin的虚拟机3.1配置ca和ssl自签证书

[[email protected] ~]# (umask 077; openssl genrsa -out /etc/pki/CA/private/cakey.pem 2048)
Generating RSA private key, 2048 bit long modulus
............................................................+++
.....+++
e is 65537 (0x10001)

[[email protected] ~]# openssl req -new -x509 -key /etc/pki/CA/private/cakey.pem -out /etc/pki/CA/cacert.pem -days 3650
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‘.‘, the field will be left blank.
-----
Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:BeiJing
Locality Name (eg, city) [Default City]:BJ
Organization Name (eg, company) [Default Company Ltd]:05HD
Organizational Unit Name (eg, section) []:DevOps
Common Name (eg, your name or your server‘s hostname) []:caserver.05hd.com
Email Address []:[email protected]

[[email protected] ~]# touch /etc/pki/CA/{serial,index.txt}
[[email protected] ~]# echo "01" > /etc/pki/CA/serial
[[email protected] ~]# mkdir -p /etc/httpd2410/extra/ssl
[[email protected] ~]# cd /etc/httpd2410/extra/ssl

[[email protected] ssl]# (umask 077; openssl genrsa -out pam.key 1024 )
Generating RSA private key, 1024 bit long modulus
.++++++
.......++++++
e is 65537 (0x10001)

[[email protected] ssl]# ll
total 4
-rw------- 1 root root 887 Aug 13 21:41 pam.key

[[email protected] ssl]# openssl req -new -key pam.key -out pam.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‘.‘, the field will be left blank.
-----
Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:BeiJing
Locality Name (eg, city) [Default City]:BJ
Organization Name (eg, company) [Default Company Ltd]:05HD
Organizational Unit Name (eg, section) []:DevOps
Common Name (eg, your name or your server‘s hostname) []:www.05hd.com
Email Address []:[email protected]

Please enter the following ‘extra‘ attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

[[email protected] ssl]# openssl ca -in pam.csr -out pam.crt -days 3650
Using configuration from /etc/pki/tls/openssl.cnf
Check that the request matches the signature
Signature ok
Certificate Details:
        Serial Number: 1 (0x1)
        Validity
            Not Before: Aug 13 13:46:38 2014 GMT
            Not After : Aug 10 13:46:38 2024 GMT
        Subject:
            countryName               = CN
            stateOrProvinceName       = BeiJing
            organizationName          = 05HD
            organizationalUnitName    = DevOps
            commonName                = pam.05hd.com
            emailAddress              = [email protected]
        X509v3 extensions:
            X509v3 Basic Constraints:
                CA:FALSE
            Netscape Comment:
                OpenSSL Generated Certificate
            X509v3 Subject Key Identifier:
                9D:88:4A:4D:B2:AB:D6:35:53:80:4D:89:D9:4E:C8:01:6B:01:60:50
            X509v3 Authority Key Identifier:
                keyid:9D:BD:DC:D0:CE:0E:EF:C2:9F:E5:CD:DC:F0:97:10:9C:E5:7F:A4:2A

Certificate is to be certified until Aug 10 13:46:38 2024 GMT (3650 days)
Sign the certificate? [y/n]:y

1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated

[[email protected] ssl]# pwd
/etc/httpd2410/extra/ssl
[[email protected] ssl]# ls -l
total 12
-rw-r--r-- 1 root root 3843 Aug 13 21:46 pam.crt
-rw-r--r-- 1 root root  688 Aug 13 21:42 pam.csr
-rw------- 1 root root  887 Aug 13 21:41 pam.key

3.2 配置基于ssl的apache虚拟主机下面是我的虚拟主机配置文件内容

[[email protected] ssl]# grep ‘^[^#]‘ /etc/httpd2410/extra/httpd-ssl.conf | grep -vE ‘^[[:space:]]+#‘
Listen 443
SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
SSLPassPhraseDialog  builtin
SSLSessionCache        "shmcb:/usr/local/apache2410/logs/ssl_scache(512000)"
SSLSessionCacheTimeout  300ServerAdmin [email protected]
    ServerName pam.05hd.com
    DocumentRoot "/web/hosta"
    SSLEngine on
    SSLCertificateFile "/etc/httpd2410/extra/ssl/pam.crt"
    SSLCertificateKeyFile "/etc/httpd2410/extra/ssl/pam.key"
    ProxyRequests Off
    ProxyPassMatch ^/(.*.php)$ fcgi://172.16.41.164:9000/home/wwwroot/phpmyadmin/$1SSLOptions +StdEnvVarsSSLOptions +StdEnvVarsRequire all grantedBrowserMatch "MSIE [2-5]"              nokeepalive ssl-unclean-shutdown              downgrade-1.0 force-response-1.0
    ErrorLog "logs/pam.05hd.com-error_log"
    CustomLog "logs/pam.05hd.com-access_log" common

3.3去php服务器上下载phpmyadmin

[[email protected] wwwroot]# pwd
/home/wwwroot
[[email protected] wwwroot]# wget "http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/4.2.7/phpMyAdmin-4.2.7-all-languages.tar.gz/download"
[[email protected] phpmyadmin]# tar xf phpMyAdmin-4.2.7-all-languages.tar.gz
[[email protected] wwwroot]# ln -s /home/wwwroot/phpMyAdmin-4.2.7-all-languages /home/wwwroot/phpmyadmin
[[email protected] wwwroot]# cp /home/wwwroot/phpmyadmin/config.sample.inc.php /home/wwwroot/phpmyadmin/config.inc.php
[[email protected] wwwroot]# sed -i "[email protected]\[‘host‘\] = ‘localhost‘\;@\[‘host‘\] = ‘172.16.41.165‘\;@" /home/wwwroot/phpmyadmin/config.inc.php

3.4去浏览器输入https://pam.05hd.com/index.php来看看效果4、下面我们去php服务器上/home/wwwroot/www.05hd.com/这个目录下弄个wordpress博客程序测试下4.1下载wordpress

[[email protected] php-5.4.31]# cd /home/wwwroot/www.05hd.com/
[[email protected] www.05hd.com]# ls
index.php
[[email protected] www.05hd.com]# rm -rf index.php
[[email protected] www.05hd.com]# wget http://cn.wordpress.org/wordpress-3.9-zh_CN.tar.gz
[[email protected] www.05hd.com]# tar xf wordpress-3.9-zh_CN.tar.gz
[[email protected] www.05hd.com]# ls
wordpress  wordpress-3.9-zh_CN.tar.gz
[[email protected] www.05hd.com]# mv wordpress/* .
[[email protected] www.05hd.com]# ls
index.php    wordpress                   wp-admin              wp-config-sample.php  wp-includes        wp-login.php     wp-signup.php
license.txt  wordpress-3.9-zh_CN.tar.gz  wp-blog-header.php    wp-content            wp-links-opml.php  wp-mail.php      wp-trackback.php
readme.html  wp-activate.php             wp-comments-post.php  wp-cron.php           wp-load.php        wp-settings.php  xmlrpc.php
[[email protected] www.05hd.com]# cp wp-config-sample.php wp-config.php

4.2 配置wordpress的数据库连接选项

来看看worpress页面的情况

Centos 6.5 配置分离式LAMP平台环境 多服务器编译安装Apache2.4.x PHP5.4.x MariaDB5.5.x

时间: 2024-12-15 01:53:12

Centos 6.5 配置分离式LAMP平台环境 多服务器编译安装Apache2.4.x PHP5.4.x MariaDB5.5.x的相关文章

基于Centos 6.5 配置分离式LAMP平台环境的一次扩展实现多PHP Apache和自建DNS来提升LAMP的负载

要达到的目的双Apache+PHP能正常的被DNS轮询解析到Apache 1 2 服务器能正常访问NFS上的静态资源PHP 1 2 服务器能正常访问NFS上的PHP资源Apache 1 2 和PHP 1 2服务器都能和MariaDB数据库服务器通信最终实现低价格提高网站负载的方案 由于这里使用了7台服务器所以下文区别服务器的方法请看命令行的[[email protected] ~]这个字段 服务器编号 服务器IP 服务器安装的服务 服务器系统 LookBack163 172.16.41.163

分离式LAMP平台构建

LAMP平台是常用的动态网站平台,现在很多情况下,因为业务请求的原因需要把Apache服务.Mysql(Mariadb)服务和PHP服务分别使用各自的Linux服务器承载,下面我就总结一下分离式LAMP平台构建过程.(我这边使用的源码编译安装) 一.平台构建准备:     1.Centos 6.6 final系统三个(基础安装,装有包组Development Tools): 192.168.2.3(Apache服务器) 192.168.2.5(PHP服务器) 192.168.2.6(Mariad

源码编译安装分离式LAMP平台

前言: LAMP是指:Linux(操作系统),Apache(Web服务器),MySQL/MariaDB(数据库),PHP/Perl/Python(脚本语言),所有组成产品各自独立的开源软件,组合在一起使用,就组成了目前互联网中流行的Web框架:与Java/J2EE架构相比,LAMP具有Web资源丰富,轻量,开发快速等特点,与微软的.NET架构相比,LAMP具有通用.跨平台.高性能.低价格的优势,因此LAMP无论是性能.质量还是价格都是企业搭建网站的首选平台. 工作原理: 分离式的LAMP架构,A

编译安装LAMP平台环境_xcache

基于Linux.Apache.Mysql.Php编译安装LAMP环境平台,并使用xcache加速php 编译安装LAMP平台: 1.下载软件包, 安装依赖包 # yum install -y pcre-devel 2.解包安装apache 2.1 编译安装apr-1.5.0 # tar xvf apr-1.5.0.tar.bz2 # cd apr-1.5.0 && ./configure --prefix=/usr/local/apr # make && make inst

第二十二天 IO模型理论、数据库基础、LAMP平台基础理论及MySQL安装部署

一.I/O模型理论 http或https都是基于tcp协议完成通讯.在tcp中使用socket通讯模型,在domain中界定socket是如何定义.                           domain有三种工作类型:                                        unix domain:每个socket地址是个文件路径                                        ipv4 domain:每个socket是ipv4:p

CentOS6.3 编译安装LAMP(2):编译安装 Apache2.2.25

所需源码包: /usr/local/src/Apache-2.2.25/httpd-2.2.25.tar.gz 编译安装 Apache2.2.25 #切换到源码目录 cd /usr/local/src/Apache-2.2.25 tar -xzvf ./httpd-2.2.25.tar.gz cd ./httpd-2.2.25 #生成configure ./configure --prefix=/usr/local/apache --with-included-apr --enable-so -

lnmp环境源码编译安装记录

系统:Cenos 6.5 X64 软件: tengine-2.0.3.tar.gz pcre-8.33.tar.bz2 mysql-5.6.12.tar.gz php-5.5.14.tar.bz2 一.安装nginx 1.1 安装nginx所需的pcre-devel库,使nginx支持HTTP Rewrite模块 [[email protected]]# ./configure --prefix=/home/webserver/pcre  && make && make i

Tesseract环境搭建及编译安装

Tesseract环境搭建及编译安装 Tesseract源码都是C++源码:对于不咋会C++的人来说,这真是...虽然说语言有相通性,但是...哎!!!!! 分享出来,也希望对大家有所帮助. 环境:win10系统,vs2017 (注:安装vs2017,在vs2017 installer  C++的桌面开发下可选插件选择windows 10 SDK(有多个版本,不知道的情况下选择第一个,防止编译的时候找不到所需要的一些东西) 个人理解:cppan:类似于java的maven,负责管理包: 1.pa

编译安装LAMP及分离式LAMP平台构建

前言 LAMP网站架构是目前国际流行的Web框架,该框架包括:Linux操作系统,Apache网站服务器,MySQL数据库,Perl.PHP或者Python编程语言,所有组成产品均是开源软件,是国际上成熟的架构框架,很多流行的商业应用都是采取这个架构,和Java/J2EE架构相比,LAMP具有Web资源丰富.轻量.快速开发等特点,与微软的.NET架构相比,LAMP具有通用.跨平台.高性能.低价格的优势,因此LAMP无论是性能.质量还是价格都是企业搭建网站的首选平台.但由于MySQL作为SUN公司