centos7下面apache源码安装
简介
安装步骤
apr/apr-util
- apr官网
- download
- apr-1.5.2.tar.gz
- apr-util-1.5.4.tar.gz
编译
cd /usr/local/src tar -zxvf apr-1.5.2.tar.gz cd apr-1.5.2 ./configure --prefix=/usr/local/apr make && make install cd /usr/local/src tar -zxvf apr-util-1.5.4.gz cd apr-util-1.5.4 ./configure \ --prefix=/usr/local/apr-util \ --with-apr=/usr/local/apr make && make install
pcre
- pcre官网
- pcre download
- pcre-8.40.tar.gz
编译
cd /usr/local/src tar -zxvf pcre-8.40.tar.gz cd pcre-8.40 ./configure --prefix=/usr/local/pcre make && make install
other program
yum -y install wget yum -y install gcc gcc-c++ yum install openssl openssl-devel -y
httpd
- apache官网
- Compiling and Installing
- apache download
- httpd-2.4.9.tar.gz
编译
./configure \ --prefix=/usr/local/apache \ --sysconfdir=/etc/httpd \ --enable-so \ --enable-ssl \ --enable-cgi \ --enable-rewrite \ --with-zlib \ --with-pcre=/usr/local/pcre \ --with-apr=/usr/local/apr \ --with-apr-util=/usr/local/apr-util \ --enable-mods-shared=most \ --enable-mpms-shared=all \ --with-mpm=prefork make && make install
添加服务
添加httpd服务
cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd vi /etc/rc.d/init.d/httpd --在文件开头加上下面2句(注:第一行3个数字参数意义分别为:哪些Linux级别需要启动httpd(3,4,5);启动序号(85);关闭序号(15)) chkconfig: 345 85 15 description: Activates/Deactivates Apache Web Server chkconfig -–add httpd
添加httpd服务
vim /usr/lib/systemd/system/httpd.service [Unit] Description=The Apache HTTP Server After=network.target remote-fs.target nss-lookup.target [Service] Type=notify EnvironmentFile=/etc/sysconfig/httpd ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND ExecReload=/usr/sbin/httpd $OPTIONS -k graceful ExecStop=/bin/kill -WINCH ${MAINPID} # We want systemd to give httpd some time to finish gracefully, but still want # it to kill httpd after TimeoutStopSec if something went wrong during the # graceful stop. Normally, Systemd sends SIGTERM signal right after the # ExecStop, which would kill httpd. We are sending useless SIGCONT here to give # httpd time to finish. KillSignal=SIGCONT PrivateTmp=true [Install] WantedBy=multi-user.target # /etc/systemd/system/httpd.service.d/nopt.conf [Service] PrivateTmp=false systemctl status httpd.sevice systemctl start httpd.sevice systemctl stop httpd.sevice systemctl restart httpd.sevice systemctl enable httpd.sevice
问题
/etc/init.d/httpd: line 97: lynx: command not found
yum install lynx -y
curl: (7) Failed connect to localhost:80; Connection refused
yum install curl -y