成都网站建设设计

将想法与焦点和您一起共享

编译安装Apache+PHP-创新互联

1.解压Apache

创新互联公司是一家专业提供北京企业网站建设,专注与成都做网站、网站制作、H5开发、小程序制作等业务。10年已为北京众多企业、政府机构等服务。创新互联专业网站设计公司优惠进行中。

tar zxvf httpd-2.4.18.tar.gz

把apr和apr-util包解压到Apache里的srclib目录里面

tar zxvf apr-1.4.6.tar.gz -C /home/software/httpd-2.4.18/srclib/

tar zxvf apr-util-1.5.2.tar.gz -C /home/software/httpd-2.4.18/srclib/

cd /home/software/httpd-2.4.18/srclib/

修改一下包名

mv apr-1.4.6 apr
mv apr-util-1.5.2 apr-util

安装apr

cd apr

./configure --prefix=/usr/local/apr
make

make install

安装apr-util

cd apr-util

./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
 make

make install

安装pcre

tar zxvf pcre-8.38.tar.gz

cd pcre-8.38

./configure

make

make install

安装Apache

cd /home/software/httpd-2.4.18

./configure --prefix=/usr/local/apache --enable-so --enable-modules=most --enable-mods-shared=all --enable-proxy --enable-rewrite --with-mpm=worker --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

make
make install

编译安装mod_fastcgi模块,并在httpd.conf中加载库文件

tar zxvf mod_fastcgi-2.4.6.tar.gz
cd mod_fastcgi-2.4.6
wget http://leeon.me/upload/other/byte-compile-against-apache24.diff

patch -p1

//apache2.4下安装mod_fastcgi 2.4.6,需要打补丁

cp Makefile.AP2 Makefile

vim Makefile 将Makefile中的路径改成你的apache的安装路径

make && make install //安装成功后,会自动把mod_fastcgi.so复制到/usr/local/apache/modules目录

在httpd.conf中添加

LoadModule fastcgi_module modules/mod_fastcgi.so

LoadModule slotmem_shm_module modules/mod_slotmem_shm.so

在httpd.conf最后面添加如下行:

         SetHandler "proxy:fcgi://127.0.0.1:9000"

添加apache用户,修改User和Group为:

User apache

Group apache

ServerName localhost:80

优化Apache

在33行添加

Timeout 60
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 5
UseCanonicalName Off
HostnameLookups Off
ServerSignature Off
ServerTokens Prod

在最后面添加:


   ServerLimit          20
   StartServers         4
   MaxClients          300
   MinSpareThreads      25
   MaxSpareThreads      75
   ThreadsPerChild      30
   MaxRequestsPerChild  0

修改权限 229行上下


     Options Indexes FollowSymLinks
    AllowOverride none
     Order deny,allow
   Require all granted

安装freetype

wget http://nchc.dl.sourceforge.net/project/freetype/freetype2/2.4.7/freetype-2.4.7.tar.gz
 tar zxvf freetype-2.4.7.tar.gz
 cd freetype-2.4.7
 ./configure --prefix=/usr/local/freetype
 make
 make install

安装jpeg

tar zxvf jpegsrc.v8c.tar.gz
cd jpeg-8c/
./configure --prefix=/usr/local/jpeg
make
make install

安装libpng

tar jxvf libpng-1.2.10.tar.bz2
cd libpng-1.2.10
./configure --prefix=/usr/local/libpng

make

make install

安装gd

tar zxvf gd-2.1.0-preview.tar.gz

cd gd-2.1.0
 ./configure --prefix=/usr/local/gd
make
make install

yum -y install libmcrypt-devel

安装PHP5.6

tar zxvf php-5.6.20.tar.gz

cd php-5.6.20

./configure --prefix=/usr/local/php5 --enable-fpm --with-mcrypt --enable-mbstring --with-curl --enable-pdo --disable-debug  --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-mysqli --with-gd --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype

make
make install

cd /usr/local/php5/etc/

cp php-fpm.conf.default php-fpm.conf

修改php端口

vi etc/php-fpm.conf

[global]

[www]

user = nobody
group = nobody

listen = 127.0.0.1:9009

pm = dynamic

pm.max_children = 5

pm.start_servers = 2

pm.min_spare_servers = 1

pm.max_spare_servers = 3

拷贝php.ini文件
cp -a /home/software/php-5.6.20/php.ini-production etc/php.ini

vi php.ini

#在930行上下,修改时区为上海

 date.timezone =Asia/Shanghai

372 max_execution_time = 600
382 max_input_time = 600

660 post_max_size = 30M

809 upload_max_filesize = 30M

保存启动PHP

/usr/local/php5/sbin/php-fpm -c /usr/local/php5/etc/php.ini

启动httpd

/usr/local/apache/bin/httpd -k start

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


本文标题:编译安装Apache+PHP-创新互联
网址分享:http://chengdu.cdxwcx.cn/article/ccjsip.html