Apache Compilation Installation

Source: Internet
Author: User
Tags fully qualified domain name

cetos7.4 under Compile and install:
Apache is the world's most used Web server software. It can run on almost all widely used computer platforms and is one of the most popular Web server-side software due to its widespread use across platforms and security. It is fast, reliable, and can be augmented with simple APIs to compile perl/python and other interpreters into the server. and Apache transliteration! (Refer to words in the network)
Packages that require source code compilation and installation
Httpd-2.4.28.tar.gz #Apache主程序包
Apr-1.5.2.tar.gz #Apache依赖包
Apr-util-1.5.4.tar.gz #Apache依赖包
Pcre-8.41.tar.gz #Apache依赖包

Download Source installation package
Http://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.28.tar.gz http://archive.apache.org/ dist/apr/apr-1.6.2.tar.gz
http://archive.apache.org/dist/apr/apr-util-1.6.0.tar.gz
ftp:// ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz
Download the latest source package
First install make, GCC, Compile tools and development packages such as OpenSSL
[[email protected] ~]# yum-y install make gcc gcc-c++ OpenSSL openssl-devel expat-devel

Install dependency Package: apr-1.5.2.tar.gz
[Email protected] ~]# Tar XF apr-1.5.2.tar.gz
[Email protected] ~]# CD apr-1.5.2
[[email protected] apr-1.5.2]#./configure--prefix=/usr/local/apr && make && make install
Compile and install the dependency package apr-util-1.5.4.tar.gz
[Email protected] ~]# Tar XF apr-util-1.5.4.tar.gz
[Email protected] ~]# CD apr-util-1.5.4
[Email protected] apr-util-1.5.4]#/configure--prefix=/usr/local/apr-util/--with-apr=/usr/local/apr/bin/ Apr-1-config && make && make install
Compile and install the dependency package pcre-8.41.tar.gz
[Email protected] pcre-8.41]# Tar XF pcre-8.41.tar.gz
[Email protected] ~]# CD pcre-8.41
[[email protected] pcre-8.41]#./configure--prefix=/usr/local/pcre && make && make install

Compile and install Apache
[Email protected] ~]# tar XF httpd-2.4.28.tar.gz-c/usr/local/src/
[Email protected] ~]# cd/usr/local/src/httpd-2.4.28/
[Email protected] 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/--with-pcre=/usr/local/pcre/&& Make & & Make Install
Note:
--enable-so #支持动态加载模块
--enable-rewrite #支持网站地址重写
--enable-ssl #支持ssl加密
--WITH-APR=/USR/LOCAL/APR #关联apr
--with-apr-util=/usr/local/apr-util #关联apr-util
--with-pcre=/usr/local/pcre #关联pcre
--libdir=/usr/lib64 #关联库文件
Configuration file
[Email protected] httpd-2.4.28]# ls/usr/local/apache/conf/httpd.conf
/usr/local/apache/conf/httpd.conf
Site root directory
[Email protected] httpd-2.4.28]# ls/usr/local/apache/htdocs/
Index.html
Generate a startup script
[Email protected] httpd-2.4.28]# CP/USR/LOCAL/APACHE/BIN/APACHECTL/ETC/INIT.D
[Email protected] httpd-2.4.28]# chmod +x/etc/init.d/apachectl

Write an Apache system service script to save this file with 754 permissions
[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

Start Apache Error:
[Email protected] httpd-2.4.28]#/etc/init.d/apachectl restart
AH00558:httpd:Could not reliably determine the server ' s fully qualified domain name, using Localhost.localdomain. Set the ' ServerName ' directive globally to suppress this message

Solve:
[Email protected] httpd-2.4.28]# vim/usr/local/apache/conf/httpd.conf
Change to:
ServerName 192.168.140.138 (server IP): 80

Launch Apache
/etc/init.d/apachectl start

Test:

Apache Compilation Installation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.