Apache 源码包安装

安装依赖包:
$ 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  Server
After=network.target

[Service]
Type=forking
PIDFile=/usr/local/httpd/logs/httpd.pid
ExecStart=/usr/local/httpd/bin/apachectl  $OPTIONS
ExecReload=/bin/kill  -HUP  $MAINPID
KillMode=process
Restart=on-failure
RestartSec=42s

[Install]
WantedBy=graphical.target

开启apache服务
$ systemctl start httpd.service

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。