LAMP一體環境快速安裝
(一)安裝Apache
1、下載安裝
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
yum install zlib-devel -y
wget http: //mirror .bit.edu.cn /apache/httpd/httpd-2 .2.31. tar .gz
tar xf httpd-2.2.31. tar .gz
cd httpd-2.2.31
. /configure
--prefix= /application/apache2 .2.31
-- enable -deflate
-- enable -expires
-- enable -headers
-- enable -modules=most
-- enable -so
--with-mpm=worker -- enable -rewrite
make make install
ln -s /application/apache2 .2.31/ /application/apache
ls -l /application/
|
2、啟動服務,檢查
1
2
|
/application/apache/bin/apachectl start
netstat -lntup| grep httpd
|
3、配置基於域名的虛擬主機
1
|
cd /application/apache/conf/
|
vim httpd.conf 修改98行
ServerName 127.0.0.1:80
修改132
<Directory “/application/apache2.2.31/html”>
修改378
Include conf/extra/httpd-mpm.conf
修改396
Include conf/extra/httpd-vhosts.conf
==============================
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
[root@web02 conf] # cd extra/
[root@web02 extra] # vim httpd-vhosts.conf
<VirtualHost *:80> ServerAdmin oldboy@oldboyedu.com
DocumentRoot "/application/apache2.2.31/html/www"
ServerName www.etiantian.org
ServerAlias etiantian.org
ErrorLog "/app/logs/www-error_log"
CustomLog "/app/logs/www-access_log" common
< /VirtualHost >
<VirtualHost *:80> ServerAdmin oldboy@oldboyedu.com
DocumentRoot "/application/apache2.2.31/html/bbs"
ServerName bbs.etiantian.org
ErrorLog "/app/logs/bbs-error_log"
CustomLog "/app/logs/bbs-access_log" common
< /VirtualHost >
<VirtualHost *:80> ServerAdmin oldboy@oldboyedu.com
DocumentRoot "/application/apache2.2.31/html/blog"
ServerName blog.etiantian.org
ErrorLog "/app/logs/blog-error_log"
CustomLog "/app/logs/blog-access_log" common
< /VirtualHost >
|
建立站點目錄及測試檔案
1
2
3
4
5
6
7
|
mkdir -p /application/apache2 .2.31 /html/ {www,bbs,blog}
echo www.etiantian.org > /application/apache2 .2.31 /html/www/index .html
echo bbs.etiantian.org > /application/apache2 .2.31 /html/bbs/index .html
echo blog.etiantian.org > /application/apache2 .2.31 /html/blog/index .html
mkdir /app/logs -p
/application/apache/bin/apachectl -t
/application/apache/bin/apachectl graceful
|
4、配置客戶端host解析到如下域名商,檢查
1
2
3
|
curl www.etiantian.org curl bbs.etiantian.org curl blog.etiantian.org |
apache基於域名的虛擬主機配置成功。
==============================================
(二)搭建PHP,本地不裝MYSQL
1、安裝依賴包並檢查
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
wget -O /etc/yum .repos.d /epel .repo http: //mirrors .aliyun.com /repo/epel-6 .repo
yum install zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel libxslt-devel libmcrypt-devel mhash mhash-devel mcrypt openssl-devel -y
rpm -qa zlib-devel libxml2-devel libjpeg-turbo-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libmcrypt-devel mhash mhash-devel mcrypt openssl-devel mkdir -p /home/oldboy/tools
cd /home/oldboy/tools
wget http: //ftp .gnu.org /pub/gnu/libiconv/libiconv-1 .14. tar .gz
tar zxf libiconv-1.14. tar .gz
cd libiconv-1.14
. /configure --prefix= /usr/local/libiconv
make make install
cd ..
|
2、安裝php(無需安裝MySQL)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
cd /home/oldboy/tools
tar xf php-5.5.26. tar .gz
cd php-5.5.26
. /configure
--prefix= /application/php5 .5.26
--with-apxs2= /application/apache/bin/apxs
--with-mysql=mysqlnd --with-iconv- dir = /usr/local/libiconv
--with-freetype- dir
--with-jpeg- dir
--with-png- dir
--with-zlib --with-libxml- dir = /usr
-- enable -xml
--disable-rpath -- enable -safe-mode
-- enable -bcmath
-- enable -shmop
-- enable -sysvsem
-- enable -inline-optimization
--with-curl --with-curlwrappers -- enable -mbregex
-- enable -mbstring
--with-mcrypt --with-gd -- enable -gd-native-ttf
--with-openssl --with-mhash -- enable -pcntl
-- enable -sockets
--with-xmlrpc -- enable -zip
-- enable -soap
-- enable -short-tags
-- enable -zend-multibyte
-- enable -static
--with-xsl -- enable - ftp
make make install
ln -s /application/php5 .5.26/ /application/php
|
檢查結果:
1
2
3
4
5
6
7
|
[root@web02 php-5.5.26] # ll /application/apache/modules/
總用量 30568 -rw-r--r-- 1 root root 9194 11月 10 20:37 httpd.exp -rwxr-xr-x 1 root root 31285631 11月 10 23:51 libphp5.so [root@web02 php-5.5.26] # grep libphp5.so /application/apache/conf/httpd.conf
LoadModule php5_module modules /libphp5 .so
[root@web02 php-5.5.26] # cp php.ini-production /application/php/lib/php.ini
|
3、配置httpd.conf
311行下增加:
1
2
|
AddType application /x-httpd-php .php .phtml
AddType application /x-httpd-php-source .phps
|
168行下增加:
1
|
DirectoryIndex index.php index.html |
67行下增加
1
2
|
User www Group www |
建立使用者:
1
2
3
4
5
|
useradd -u 513 -s /sbin/nologin www
id www
/application/apache/bin/apachectl -t
/application/apache/bin/apachectl graceful
|
檢查PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<?php phpinfo(); ?> 檢查MySQL: <?php $link_id =mysql_connect( `db01.etiantian.org` , `wordpress` , `123456` ) or mysql_error();
if ( $link_id ){
echo "mysql successful by oldboy training!" ;
}
else {
echo mysql_error();
}
?>
|
本文轉自027ryan 51CTO部落格,原文連結:http://blog.51cto.com/ucode/1719533,如需轉載請自行聯絡原作者
相關文章
- 編譯安裝LAMP環境編譯LAMP
- CentOS5.5下快速編譯安裝最新的LAMP環境CentOS編譯LAMP
- centos 7.2 64位 docker安裝lamp環境CentOSDockerLAMP
- 搭建lamp環境以及安裝配置phpmyadminLAMPPHP
- PHP環境LAMP/LNMP安裝與配置筆記PHPLAMPLNMP筆記
- 阿里雲體驗實驗室教程《快速搭建LAMP環境》阿里LAMP
- 在原始碼安裝的LAMP環境中搭建Nagios原始碼LAMPiOS
- HHvm建站環境搭建方法:Nginx、lnmp/lamp等安裝部署NginxLNMPLAMP
- 一鍵化安裝 docker,一鍵化部署 lnmp+Redis 環境,快速部署 Laravel 環境DockerLNMPRedisLaravel
- php環境搭建---LAMPPHPLAMP
- Apache伺服器的編譯安裝和LAMP環境的構建Apache伺服器編譯LAMP
- linux搭建lamp環境LinuxLAMP
- 【TAR】【安裝】Linux環境使用TAR命令快速部署安裝OracleLinuxOracle
- lamp安裝LAMP
- zabbix一鍵安裝lnmp環境LNMP
- Java軟體安裝以及環境配置Java
- CodeMan快速安裝配置教程:Windows下安裝配置Java JDK環境WindowsJavaJDK
- 快速搭建 Linux(LNMP + Linux 安裝 + 環境配置)LinuxLNMP
- dbdeployer 快速安裝MySQL8.0各測試環境MySql
- Gitlab環境快速部署(RPM包方式安裝)Gitlab
- 編譯LAMP環境之PHP編譯LAMPPHP
- LAMP環境搭建-MySQL5.6LAMPMySql
- 【轉】 Windows下LAMP環境搭建WindowsLAMP
- LNMP 環境安裝LNMP
- golang環境安裝Golang
- swoft環境安裝
- futter環境安裝
- 安裝LNMP環境LNMP
- yum安裝lampLAMP
- Jenkins 一: 環境安裝以及配置Jenkins
- Windows 環境下 Python 環境安裝WindowsPython
- Poechant快速安裝配置教程:Windows + Cygwin + Boost開發環境Windows開發環境
- LAMP(CentOS 7.2)環境下搭建WordPressLAMPCentOS
- CentOS 7.3搭建LAMP環境和WordpressCentOSLAMP
- ubuntu18搭建LAMP環境+部署圖片上傳網頁+安裝MosquittoUbuntuLAMP網頁UI
- LAMP原始碼安裝+wordpress安裝LAMP原始碼
- Ubuntu 環境安裝 phpunitUbuntuPHP
- macOS 安裝 LNMP 環境MacLNMP