# # # # #安装Apache需要软件包的支持 ######
Apr-1.6.2.tar.gz
Apr-util-1.6.0.tar.gz
Httpd-2.4.29.tar.gz
·
[Email protected] opt]# Tar XF apr-1.6.2.tar.gz
[Email protected] opt]# Tar XF apr-util-1.6.0.tar.gz
[Email protected] opt]# Tar XF httpd-2.4.34.tar.bz2
·
[Email protected] opt]# MV apr-1.6.2 HTTPD-2.4.29/SRCLIB/APR
[Email protected] opt]# MV apr-util-1.6.0 httpd-2.4.34/srclib/apr-util
·
·
Yum-y install \
GCC \
gcc-c++ \
Make \
Pcre-devel \
Expat-devel \
Perl
·
# # # # #源码编译及安装 ###### configuration, compilation, installation
·
1) configuration
CD httpd-2.4.34
./configure--prefix=/usr/local/httpd--enable-so--enable-rewrite--enable-charset-lite--enable-cgi
--prefix: Specifies that the HTTPD service is installed in that directory, such as/USR/LOCAL/HTTPD.
--ENABLE-SO: Enable dynamic load module support, so that the httpd has further extended functionality.
--enable-rewrite: Enable Web page address rewriting for site optimization and directory Migration maintenance.
--enable-charset-lite: Launch character set support to support Web pages that are encoded using a variety of character sets
--ENABLE-CGI: Enables CGI scripting support to extend the application access capabilities of the Web site.
2) Compile and install
After the configuration is complete, execute the "make" command to compile, convert the source code into an executable program, and then execute the "make install" command to complete the final installation process. Copy the compiled HTTPD program and related directories and files to the preset installation directory (as configured by the "- Prefix "option specified). The "make" process may take a longer time.
Mske
Make-install
############## #命令优化 ####################
·
Cd/usr/local/httpd
ln/usr/local/httpd/bin/*/usr/local/bin
Ln-s/usr/local/httpd/conf/httpd.conf/etc/
·
############ #添加httpd系统服务 ###########
Cp/usr/local/httpd/bin/apachectl/etc/init.d/httpd
Vi/etc/init.d/httpd
#chkconfig: 35 85 21//35 level Auto Run 85th start 21st off
#description: Apache is a world Wide WEB server//Service description information
·
Chkconfig--add httpd # # # #将httpd添加为系统服务
·
########## #修改httpd. conf Master Profile #################
ServerName www.bdqn.com # # #修改为域名或ip
·
ServerRoot: Set the root directory of the httpd server
Listen: Set httpd server port number default 80
ServerName: Set the domain name of the Web site
DocumentRoot: Set the site root directory, that is, the actual location of the Web document in the system storage path
Directorylndex: Set the default home page of the site, you can set multiple home pages separated by spaces
Errorlog: Set the path to the error log file, the default path is Log/error_log
·
############# #验证 #################
Systemctl Stop Firewalld.service # # #关闭防火墙
·
Httpd-t or Apachectl-t # # #用来检测httpd. conf to check for syntax errors
Prompt syntax OK If there is no syntax error
·
Service httpd Start
NETSTAT-ANPT | grep 80
·
If you cannot access it, you need to add the domain name resolution in etc/hosts
·
Verify with the system's browser
Validation successful
(Note that the default content of the Web page is:/usr/local/httpd/htdocs/index.html)
Install HTTPD server and verify