安装apache2.4.39

lamp环境搭建(centos6.9+apache2.4.39+mysql5.7+php7.1)

安装前准备:CentOS 6.9 64位 最小化安装

yum install -y make gcc gcc-c++ perl zlib-devel libaio libpng libpng-devel libjpeg-devel pcre-devel
yum install -y libXpm-devel openssl openssl-devel libxml2-devel bzip2-devel.x86_64 libjpeg-turbo-devel
yum install -y freetype freetype-devel libtool cmake ncurses-devel bison re2c curl-devel wget
rpm -ivh “http://mirrors.sohu.com/fedora-epel/epel-release-latest-6.noarch.rpm”
yum install -y libmcrypt-devel re2c

安装apache2.4.39

cd /usr/local/src
wget https://mirrors.tuna.tsinghua.edu.cn/apache/httpd//httpd-2.4.39.tar.gz
wget http://mirror.bit.edu.cn/apache/apr/apr-1.6.5.tar.gz
wget http://mirror.bit.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
tar zxvf httpd-2.4.39.tar.gz
tar zxvf apr-1.6.5.tar.gz
tar zxvf apr-util-1.6.1.tar.gz

cp -r apr-1.6.5 /usr/local/src/httpd-2.4.39/srclib/apr
cd apr-1.6.5
./configure --prefix=/usr/local/apr
make && make install
cp -r apr-util-1.6.1 /usr/local/src/httpd-2.4.39/srclib/apr-util
cd /usr/local/src/apr-util-1.6.1
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install

cd /usr/local/src/httpd-2.4.39
./configure --prefix=/usr/local/apache2 --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared
make && make install

yum install expat-devel -y
cd /usr/local/apache2/
vi conf/httpd.conf
找到
#ServerName www.example.com:80
改成
ServerName localhost:80

配置启动脚本
cp /usr/local/src/httpd-2.4.29/build/rpm/httpd.init /etc/init.d/httpd
注意文件中有三处主要的地方需要修改下的:请根据自己的实际情况更改相应的路径!

httpd= H T T P D − / u s r / l o c a l / a p a c h e 2 / b i n / h t t p d p i d f i l e = {HTTPD-/usr/local/apache2/bin/httpd} pidfile= HTTPD/usr/local/apache2/bin/httpdpidfile={PIDFILE-/usr/local/apache2/logs/${prog}.pid}
CONFFILE=/usr/local/apache2/conf/httpd.conf
然后运行如下命令:

chmod +x /etc/init.d/httpd
chkconfig --add httpd
chkconfig httpd on
/etc/init.d/httpd start
netstat -lnp |grep httpd

猜你喜欢

转载自blog.csdn.net/LYidiandian/article/details/103127936