注:本實驗是在關(guān)閉iptables 和selinux 的情況下進行的。
創(chuàng)新互聯(lián)建站服務(wù)項目包括自流井網(wǎng)站建設(shè)、自流井網(wǎng)站制作、自流井網(wǎng)頁制作以及自流井網(wǎng)絡(luò)營銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢、行業(yè)經(jīng)驗、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,自流井網(wǎng)站推廣取得了明顯的社會效益與經(jīng)濟效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到自流井省份的部分城市,未來相信會繼續(xù)擴大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!
安裝環(huán)境
[root@server ~]# yum -y install perl gd gd-devel libpng libpng-devel libjpeg libjpeg-devel zlib zlib-devel pcre-devel gcc gcc-c++ make cmake autoconf openssl openssl-devel ncurses-devel patch libxml2 libxml2-devel curl-devel openldap openldap-devel libevent libevent-devel bison icu libicu-devel libtool readline-devel net-snmp-devel bzip2-devel freetype-devel vim
一、搭建LAMP環(huán)境
(1) 安裝apache
安裝http
[root@server lamp]# tar zxvf httpd-2.2.22.tar.gz
[root@server lamp]# cd httpd-2.2.22
[root@server httpd-2.2.22]#./configure --prefix=/usr/local/apache --enable-so --enable-sl --enable-cgi --enable-rewrite --with-zlib \
--with-pcre
[root@server httpd-2.2.22]# make && make install
啟動測試apache
[root@server ~]# /usr/local/apache/bin/apachectl start
(2) 安裝MySQL
[root@server ~]# useradd -s /sbin/nologin -M mysql
[root@server lamp]# tar zxvf mysql-5.5.29.tar.gz
[root@server lamp]# cd mysql-5.5.29
[root@server mysql-5.5.29]# cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DINSTALL_DATADIR=/data/mysql \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=complex \
-DMYSQL_USER=mysql
[root@server mysql]# chown -R root .
[root@server mysql]# cp support-files/my-medium.cnf /etc/my.cnf
[root@server php]# vim /etc/my.cnf
添加以下內(nèi)容:
[mysqld]
port = 3306
socket = /tmp/mysql.sock
basedir = /usr/local/mysql
datadir = /data/mysql
user = mysql
character_set_server = utf8
配置mysql 啟動
[root@server mysql]# cp support-files/mysql.server /etc/init.d/mysql
[root@server mysql]# vim /etc/init.d/mysql
添加以下兩行
basedir=/usr/local/mysql
datadir=/data/mysql
[root@server mysql]# service mysql start
Starting MySQL... SUCCESS!
查看mysql是否已經(jīng)啟動
[root@server mysql]# netstat -nultp |grep mysql
0.0.0.0:3306 0.0.0.0:* LISTEN 64819/mysqld
(3) 安裝php
[root@server php-5.4.11]# useradd -s /sbin/nologin -M fpmuser
[root@server lamp]# tar zxvf php-5.4.11.tar.gz
[root@server php-5. 4.11]#
./configure --prefix=/usr/local/php \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-config-file-path=/etc \
--with-freetype-dir --with-jpeg-dir \
--with-png-dir --enable-zip \
--with-zlib --enable-xml \
--with-gd --with-mhash \
--with-libxml-dir=/usr --enable-mbstring \
--enable-fpm --with-fpm-user=fpmuser \
--with-fpm-group=fpmuser --disable-ipv6 \
--enable-sockets --with-openssl \
--with-bz2 --with-curl --enable-dba=shared \
--with-pcre-dir --with-gd --with-jpeg-dir --with-png-dir \
--with-zlib-dir --enable-mbstring \
--with-mysql=/usr/local/mysql/ \
--with-mysql-sock=/tmp/mysql.sock \
--with-mysqli=/usr/local/mysql/bin/mysql_config
[root@server php-5. 4.11]# make
[root@server php-5. 4.11]# make install
[root@server php-5.4.11]# cp php.ini-production /usr/local/php/lib/php.ini
[root@server php-5.4.11]# cd /usr/local/php/etc/
[root@server etc]# cp -a php-fpm.conf.default php-fpm.conf
[root@server etc]# cd ..
啟動php
[root@server php]# sbin/php-fpm
(4) 配置apache
[root@server html]# vim /usr/local/apache/conf/httpd.conf
找到DirectoryIndex index.html index.html.var
修改為DirectoryIndex index.html index.php
接著增加如下內(nèi)容:
AddType application/x-httpd-php .php
修改完如下:
DirectoryIndex index.html index.php
AddType application/x-httpd-php .php
添加虛擬目錄測試lamp
[root@server ~]# vim /usr/local/apache/conf/httpd.conf
添加以下內(nèi)容
Alias /test "/usr/local/apache/test"
AuthType Basic
Options None
AllowOverride None
Order allow,deny
Allow from all
創(chuàng)建Php測試頁面
[root@server ~]# mkdir /usr/local/apache/test
[root@server ~]# vim /usr/local/apache/test/index.php
添加以下內(nèi)容:
phpinfo();
?>
配置完成后重啟apache
[root@server html]# /usr/local/apache/bin/apachectl restart
測試PHP 頁面
打開瀏覽器訪問:
http://ip/test/index.php
至此LAMP環(huán)境配置完成
相關(guān)軟件包下載:http://down.51cto.com/data/699395