安装依赖包:
$ rpm -ivh apr-1.4.8-3.el7.x86_64.rpm
$ rpm -ivh apr-devel-1.4.8-3.el7.x86_64.rpm
$ rpm -ivh cyrus-sasl-devel-2.1.26-20.el7_2.x86_64.rpm
$ rpm -ivh expat-devel-2.1.0-8.el7.x86_64.rpm
$ rpm -ivh libdb-devel-5.3.21-19.el7.x86_64.rpm
$ rpm -ivh openldap-devel-2.4.40-13.el7.x86_64.rpm
$ rpm -ivh apr-util-devel-1.5.2-6.el7.x86_64.rpm
$ rpm -ivh apr-util-1.5.2-6.el7.x86_64.rpm
$ rpm -ivh pcre-devel-8.32-15.el7_2.1.x86_64.rpm
$ rpm -ivh pcre-8.32-15.el7_2.1.x86_64.rpm
apache源码编译及安装
解包
$ tar zxf httpd-2.4.25.tar.gz -C /usr/src
配置
$ ./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi
编译及安装
$ make && make install
$ ls /usr/local/httpd
执行优化路径
$ ln -s /usr/local/httpd/bin/* /usr/local/bin
$ ls -l /usr/local/bin/httpd /usr/local/bin/apachectl
b)启动服务后,客户端通过http://IP能访问默认的网站。
$ vim /lib/systemd/system/httpd.service
[Unit]Description=The Apache HTTP ServerAfter=network.target[Service]Type=forkingPIDFile=/usr/local/httpd/logs/httpd.pidExecStart=/usr/local/httpd/bin/apachectl $OPTIONSExecReload=/bin/kill -HUP $MAINPIDKillMode=processRestart=on-failureRestartSec=42s[Install]WantedBy=graphical.target
开启apache服务
$ systemctl start httpd.service
作者:graceful_black
链接:https://www.jianshu.com/p/b75a6f921d2c
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。