apache在Ubuntu20.04下源码安装教程

傻瓜式哦~保证只要版本对的上,必成功

一步一步执行下面语句,执行完之后就好使了!!!

wget https://dlcdn.apache.org/httpd/httpd-2.4.57.tar.gz
wget https://dlcdn.apache.org//apr/apr-1.7.4.tar.gz
wget https://dlcdn.apache.org//apr/apr-util-1.6.3.tar.gz
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.45/pcre-8.45.tar.gz
tar -zxvf httpd-2.4.57.tar.gz
tar -zxvf apr-1.7.4.tar.gz
tar -zxvf apr-util-1.6.3.tar.gz 
tar -zxvf pcre-8.45.tar.gz
sudo apt-get install make
sudo apt-get install libexpat1-dev
sudo apt-get install build-essential

1.
cd apr-1.7.4/
./configure --prefix=/usr/local/apr/apr-1.7.4
sudo make 
sudo make install
sudo nano /etc/ld.so.conf
/usr/local/apr/apr-1.7.4/lib
sudo ldconfig

2.
cd apr-util-1.6.3/
./configure --prefix=/usr/local/apr/util/apr-util-1.6.3 --with-apr=/usr/local/apr/apr-1.7.4
sudo make 
sudo make install
sudo nano /etc/ld.so.conf
/usr/local/apr/util/apr-util/apr-util-1.6.3/lib
sudo ldconfig

3.
cd pcre-8.45/
./configure --prefix=/usr/local/pcre --with-apr-util=/usr/local/apr/util/apr-util-1.6.3 --with-apr=/usr/local/apr/apr-1.7.4
sudo make 
sudo make install
sudo nano /etc/ld.so.conf
/usr/local/apr/pcre/lib
sudo ldconfig

4.
cd httpd-2.4.57/
./configure --prefix=/usr/local/apache --enable-so --enable-mods-shared=most --enable-proxy-balancer=shared --enable-proxy-http=sahred --enable-proxy-ajp --enable-rewrite --with-apr=/usr/local/apr/apr-1.7.4 --with-apr-util=/usr/local/apr/util/apr-util-1.6.3 --with-pcre=/usr/local/pcre/bin/pcre-config
sudo make
如果报错了,那么就是上面任何一步出错了,回到对应操作重新开始试试
sudo make install

5.
sudo nano /usr/local/apache/conf/httpd.conf
ServerName 127.0.0.1:80
上面ip想写啥写啥。
sudo cp /usr/local/apache/bin/apachectl /usr/bin
sudo apachectl start
可以去访问啦

6.
sudo ufw allow 80
sudo apachectl restart

7.
cd /usr/local/apache/htdocs
sudo nano index.html
以后要配置默认访问页面可以都存在当前目录下
8.需要将默认访问页面设置成自己的只需要进行如下操作
sudo nano /usr/local/apache/conf/httpd.conf
<IfModule dir_module>
    DirectoryIndex index.html        #将这里的index.html文件改成自己的文件名
</IfModule>

https://blog.csdn.net/qq_61051103/article/details/137176391?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22137176391%22%2C%22source%22%3A%22qq_61051103%22%7Dicon-default.png?t=N7T8https://blog.csdn.net/qq_61051103/article/details/137176391?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22137176391%22%2C%22source%22%3A%22qq_61051103%22%7D具体安装流程在上述链接(包含后期shell编程)
 

  • 13
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值