源码编译安装apache
2018-03-21 17:26
453 查看
一、安装依赖包
yum -y install wget make gcc gcc-c++ pcre openssl openssl-devel zlib unzip cmake ncurses-devel libjpeg libjpeg-devel libpng libpng-devel libxml2 libxml2-devel curl-devel libtool libtool-ltdl libtool-ltdl-devel libevent libevent-devel zlib-static zlib-devel autoconf pcre-devel gd perl freetype freetype-devel
二、安装apr
三、安装apr-util
四、编译安装apache
五、修改apache配置(/etc/httpd/httpd.conf)
六、增加apache环境变量
七、配置apache开机启动
八、启动|停止|重启apache方式
九、apache和php的整合
十、设置php支持apache配置文件
yum -y install wget make gcc gcc-c++ pcre openssl openssl-devel zlib unzip cmake ncurses-devel libjpeg libjpeg-devel libpng libpng-devel libxml2 libxml2-devel curl-devel libtool libtool-ltdl libtool-ltdl-devel libevent libevent-devel zlib-static zlib-devel autoconf pcre-devel gd perl freetype freetype-devel
二、安装apr
wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.6.3.tar.gz tar xf apr-1.6.3.tar.gz cd apr-1.6.3 ./configure --prefix=/usr/local/apr/ make make install
三、安装apr-util
wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz tar -zxvf apr-util-1.6.1.tar.gz cd apr-util-1.6.1 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr make make install
四、编译安装apache
#创建运行apache的用户 groupadd www useradd -g www www -s /bin/false #下载软件 wget http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.29.tar.gz tar -zxvf httpd-2.4.29.tar.gz cd httpd-2.4.29 #编译 ./configure --prefix=/usr/local/httpd/ \ --sysconfdir=/etc/httpd/ \ --with-include-apr \ --disable-userdir \ --enable-headers \ --with-mpm=worker \ --enable-modules=most \ --enable-so \ --enable-deflate \ --enable-defate=shared \ --enable-expires-shared \ --enable-rewrite=shared \ --enable-static-support \ --with-apr=/usr/local/apr/ \ --with-apr-util=/usr/local/apr-util/bin \ --with-ssl \ --with-z make make install
五、修改apache配置(/etc/httpd/httpd.conf)
# 修改 将#ServerName www.example.com:80 改 ServerName locahost:80 #修改用户和用户组 把user=deamon group=deamon 改成 user=www group=www
六、增加apache环境变量
cat >> /etc/profile << END export PATH=$PATH:/usr/local/httpd/bin/ END source /etc/profile
七、配置apache开机启动
cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd 修改你的vim /etc/init.d/httpd脚本 在开始处#!/bin/bash之后的行后插入 # chkconfig: 345 61 61 # description:Apache httpd # 增加服务 chkconfig --add httpd chkconfig --level 2345 httpd on
八、启动|停止|重启apache方式
启动|停止|重启 /etc/init.d/httpd start|stop|restart #扩展 启动 /usr/local/httpd/bin/apachectl -f /etc/httpd/httpd.conf 暴力停止 /usr/local/httpd/bin/apachectl -k stop 优雅停止 /usr/local/httpd/bin/apachectl -k graceful-stop 优雅的重启 /usr/local/httpd/bin/apachectl -k graceful 暴力重启 /usr/local/httpd/bin/apachectl -k restart
九、apache和php的整合
./configure --prefix=/usr/local/php/ \ --with-config-file-path=/usr/local/php/etc/ \ --with-apxs2=/usr/local/httpd/bin/apxs \ #主要是这个模块 --enable-fpm \ --with-zlib \ --with-libxml-dir \ --enable-sockets \ --with-curl \ --with-jpeg-dir \ --with-png-dir \ --with-gd \ --with-iconv-dir \ --with-freetype-dir \ --enable-gd-native-ttf \ --with-xmlrpc \ --with-openssl \ --with-mhash \ --with-mcrypt \ --with-pear \ --enable-mbstring \ --enable-sysvshm \ --enable-zip \ --with-mysql=/usr/local/mysql/ \ --with-mysqli=/usr/local/mysql/bin/mysql_config \ --with-mysql-sock \ --with-pdo-mysql \ --disable-fileinfo make make install 备注:libiconv和libmcrypt以及mysql应提前安装好,路径都安装在了/usr/local目录下
十、设置php支持apache配置文件
# 编辑apache配置文件 vim /etc/httpd/httpd.conf # 添加php支持 AddType application/x-httpd-php .php .phtml AddType application/x-httpd-php-source .phps # 添加默认索引页面index.php,再找到“DirectoryIndex”,在index.html后面加上“ index.php” DirectoryIndex index.html index.php # 不显示目录结构,找到“Options Indexes FollowSymLinks”,修改为 Options FollowSymLinks # 开启apache支持伪静态,找到“AllowOverride None”,修改为 AllowOverride All
相关文章推荐
- Linux,debian下源码编译安装gcc + apache2.2.6+php5.1.16+mysql5.0.
- 虚拟机CentOS7最小化安装下源码编译搭建LAMP环境之二: ————Apache编译安装
- 源码编译安装 apache, nginx, axel
- 源码编译安装Apache服务
- centos 7.1 apache 源码编译安装
- 基于cdh5.10.x hadoop版本的apache源码编译安装spark
- CentOS 源码编译安装LAMP(Apache MySQL PHP)
- apache源码编译安装详解
- Linux[Centos6.3] 源码编译安装配置 SVN+Apache
- Apache2.4 + PHP 5.5 源码编译安装
- linux 源码编译安装apache
- apache源码编译安装时报错:configure: error: ...No recognized SSL/TLS toolkit detected
- debian下源码编译安装apache
- CentOS 4.4下源码编译安装apache+php+mysql
- 源码编译安装Apache开机自启动
- 我的LAMP源码编译安装linux+Apache+mysql+php
- Apache2.4源码编译安装的依赖问题
- centos6下源码编译安装LAMP平台(apache2.4+php5.4+mysql5.5.30)
- 详解Centos源码编译安装Apache、PHP 推荐
- apache源码编译安装./configure时出现gcc报错