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的配置的部分编译配置。