ubuntu 安装 apache2 + php5(简短文字版)

图文版查看:https://www.cnblogs.com/amnotgcs/p/14011543.html

一、编译安装 apache

1.1 下载编译前需要的包

# 编译器(有则不需要安装)
sudo apt install gcc g++ make

# apr
wget https://mirror.bit.edu.cn/apache//apr/apr-1.7.0.tar.gz
tar zxvf apr-1.7.0.tar.gz | tail
cd apr-1.7.0
su
./configure
make && make install

# apr-util
wget https://mirror.bit.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
tar zxvf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1
su
./configure --with-apr=/usr/local/apr
make && make install

# pcre
wget https://nchc.dl.sourceforge.net/project/pcre/pcre/8.44/pcre-8.44.tar.gz
tar zxvf pcre-8.44.tar.gz | tail
su
./configure
make && make install

1.2 下载编译安装 apache2

wget https://mirrors.bfsu.edu.cn/apache//httpd/httpd-2.4.46.tar.gz
tar zxvf httpd-2.4.46.tar.gz
cd httpd-2.4.46
su
./configure
make && make install

1.3 启动测试

# 启动服务器
cd /usr/local/apache2/
su
bin/apachectl -k start
# 访问服务器主页查看结果
cd
wget localhost
cat index.html
上一篇:Ubuntu安装WebDav


下一篇:新手在ubuntu下用命令安装apache2及卸载