Apache infrastructure

Apache infrastructure

Solve the dependency package first

Insert picture description here

[root@client2 ~]# ll

Insert picture description here

Unzip dependency package

 tar zxvf apr-1.6.2.tar.gz 
 tar zxvf apr-util-1.6.0.tar.gz 
tar jxvf httpd-2.4.29.tar.bz2 

Then cut and rename

mv apr-1.6.2 httpd-2.4.29/srclib/apr
mv apr-util-1.6.0 httpd-2.4.29/srclib/apr-util

Install yum

[root@client2 ~]# yum -y install pcre pcre-devel perl expat-develzlib-devel

Enter httpd-2.4.29/

[root@client2 ~]# cd httpd-2.4.29/

Load, compile and install

[root@client2 httpd-2.4.29]# ./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi --enable-expires
[root@client2 httpd-2.4.29]make && make install

Copy files and modify configuration files

[root@client2 httpd-2.4.29]#cd
[root@client2 ~]#cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd[root@client2~]#vi /etc/init.d/httpd 

Insert picture description here

[root@client2~]#chkconfig --add httpd #chkconfig管理httpd
[root@client2~]#systemctl start httpd

Soft link and modify configuration file

root@client2 ~]#ln -s /usr/local/httpd/conf/httpd.conf /etc/
[root@client2 ~]#vi /etc/httpd.conf 
![在这里插入图片描述](https://img-blog.csdnimg.cn/20201126170115601.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl81MDM0NjkwMg==,size_16,color_FFFFFF,t_70#pic_center)
[root@client2 ~]#ln -s /usr/local/httpd/bin/* /usr/bin/

Add the local ip address and domain name in vi /etc/hosts


192.168.188.10 www.aa.com
在配置文件末尾添加

Test command

[root@client2 ~]#httpd -t
Syntax OK
[root@client2 ~]#apachectl -t
Syntax OK

Last browser test

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_50346902/article/details/110188069