lamp編譯安裝與nginx共存
01
置頂處[lnmp編譯安裝][1]的php安裝在/usr/local/路徑下,本篇為lamp編譯安裝。apache與nginx共存,適用於apache的php安裝在/usr/下
02
apache安裝
03
依賴兩個包apr,apr-util,資源都在apache官網下。
04
1.apr
05
tar xf apr-1.4.6.tar.bz2
06
cd apr-1.4.6
07
sudo ./configure --help | less (可以查看幫助文件)
08
sudo ./configure --prefix=/usr/local/apr (指定安裝路徑)
09
sudo make
10
sudo make install
11
12
2.apr-util
13
tar xf apr-util-1.5.2.tar.bz2
14
cd apr-util-1.5.2
15
sudo ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
16
(--prefix指定安裝路徑;--with-apr指定apr的安裝路徑,apr-util依賴於apr)
17
sudo make && make install
18
19
3.appache
20
開始編譯
21
tar xf httpd-2.4.4.tar.bz2
22
cd httpd-2.4.4
23
sudo ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-cgid --enable-modules=most --enable-mods-shared=most --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-mpms-shared=all --with-mpm=event
24
--sysconfdir=/etc/httpd :指定配置文件安裝位置
25
--enable-so :支持動態共享模塊如果沒有這個模塊PHP將無法與apache結合工作
26
--enable-ssl :啟用支持ssl
27
--enable-cgi :支持cgi
28
--enable-rewrite :支持URL重寫
29
--with-zlib :壓縮庫,在互聯網上傳播時可節約帶寬
30
--with-apr=/usr/local/apr :指定apr路徑
31
--with-apr-util=/usr/local/apr-util :指定apr-util路徑
32
--enable-mpms-shared=all 支持多道處理模塊
33
--with-mpm=event 設定默認的模塊
34
sudo make
35
sudo make install
36
37
啟動apache
38
sudo /usr/local/apache/bin/apachectl start
39
40
mysql安裝
41
與置頂的lnmp安裝方法一致,為二進制安裝。
42
43
php安裝
44
依賴文件 :libbz2 libfreetype6-dev libltdl-dev libxml2-dev libpng12-dev libjpeg-dev libmcrypt-dev libcurl4-openssl-dev
45
編譯配置:
46
sudo ./configure --prefix=/usr/php --with-config-file-path=/usr/php/etc --with-config-file-scan-dir=/usr/php/lib/php --with-mcrypt --with-jpeg-dir --with-png-dir --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql/bin/mysql_config --with-mysqli=/usr/local/mysql/bin/mysql_config --with-openssl --with-zlib --with-freetype-dir --enable-mbstring --enable-sockets --with-curl --with-gd --with-iconv-dir --with-pcre-dir --with-xmlrpc --enable-ftp --enable-gd-jis-conv --enable-gd-native-ttf --enable-soap --enable-mod-charset --enable-mysqlnd --enable-shmop --enable-zip --enable-static --enable-debug --enable-exif --enable-bcmath --enable-fpm --with-apxs2=/usr/local/apache/bin/apxs --with-bz2 --enable-maintainer-zts
47
sudo make
48
sudo make install
49
sudo cp php.ini-development /usr/php/etc/php.ini
50
sudo useradd --no-create-home --shell=/sbin/nologin www
51
cd /usr/php/etc
52
sudo cp php-fpm.conf.default php-fpm.conf
53
sudo vim php-fpm.conf (修改user=www group=www)
54
55
56
1.相關問題
57
apache啟動
58
1. AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
59
60
61
62
63
有部分內容從jqhoudun的[博客][2]內截取,包括apr,apr-util,apache的編譯安裝,php的配置的部分編譯配置。