【apache编译】安装版本2
2.2.1源码安装Apache yum install apr-util apr-util-devel apr apr-devel pcre pcre-devel zlib zlib-devel openssl openssl-devel gcc cmake gcc-c++ -y #少包会报错 [root@xuegod65 ~]# tar xf apr-1.5.2.tar.gz -C /usr/local/src/ [root@xuegod65 ~]# cd /usr/local/src/apr-1.5.2/ [root@xuegod65 apr-1.5.2]# ./configure --prefix=/usr/local/apr [root@xuegod65 apr-1.5.2]# echo $? 0 [root@xuegod65 apr-1.5.2]# make && make install [root@xuegod65 apr-1.5.2]#echo $? 0 编译安装依赖包apr-util-1.5.4tar.gz [root@xuegod65 ~]# tar xf apr-util-1.5.4.tar.gz -C /usr/local/src/ [root@xuegod65 ~]# cd !$ cd /usr/local/src/ [root@xuegod65 src]# cd apr-util-1.5.4/ [root@xuegod65 apr-util-1.5.4]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr [root@xuegod65 apr-util-1.5.4]# grep processor /proc/cpuinfo | wc -l [root@xuegod65 apr-util-1.5.4]# make && make install [root@xuegod65 apr-util-1.5.4]# echo $? 0 解决:如果有报错可以安装 yum install expat-devel 编译安装Apache [root@xuegod65 ~]# tar zxvf httpd-2.4.28.tar.gz -C /usr/local/src/ [root@xuegod65 ~]# cd /usr/local/src/httpd-2.4.28/ [root@xuegod65 httpd-2.4.28]#./configure --prefix=/usr/local/apache --enable-so --enable-rewrite --enable-ssl --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most --enable-mpms-shared=all --with-mpm=event [root@xuegod65 httpd-2.4.28]#echo $? 0 --prefix=/usr/local/apache #安装路径 --enable-so #支持动态加载模块 --enable-rewrite #支持网站地址重写 --enable-ssl #支持SSL加密 --with-apr=/usr/local/apr #apr路径 --with-apr-util=/usr/local/apr-util #apr-util路径 [root@xuegod65 httpd-2.4.28]# make -j 2 && make install [root@xuegod65 httpd-2.4.28]# echo $? 0 配置文件 [root@xuegod65 ~]# ls /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf 网站根目录 [root@xuegod65 ~]# ls /usr/local/apache/htdocs/ index.html 生成启动脚本 [root@xuegod65 ~]# cp /usr/local/apache/bin/apachectl /etc/init.d/ [root@xuegod65 ~]# chmod +x /etc/init.d/apachectl [root@xuegod65 ~]#vi /usr/lib/systemd/system/apache.service [Unit] Description=apache After=network.target [Service] Type=forking ExecStart=/etc/init.d/apachectl start ExecReload=/etc/init.d/apachectl restart ExecStop=/etc/init.d/apachectl stop PrivateTmp=true [Install] WantedBy=multi-user.target [root@xuegod65 ~]# chmod 754 !$ chmod 754 /usr/lib/systemd/system/apache.service [root@xuegod65~]# systemctl enable apache 启动服务 [root@xuegod65 ~]# systemctl restart apache
yum安装apache php
yum install make gcc gcc-c++ penssl openssl-devel expat-devel pcre apr apr-util yum install -y httpd php php-mysql php-mbstring php-bcmath ntp libcurl-devel php-xml php-gd libevent-devel curl-* libxml-* ehco "<?php phpinfo(); ?>" /var/www/html/index.php systemctl start httpd
满血拉二胡 残血到处浪

浙公网安备 33010602011771号