一,介绍

     之前的http配置文件都在http.conf里面,现在都是在apache2.conf里面,并且只是一个汇总。

/etc/apache2$ ls apache2.conf
apache2.conf

 

二,安装httpd服务器

1,在终端执行

guoyanzhang@debian:~/test$ sudo apt-get install httpd

输出如下信息

debian10安装httpd服务器(命令行安装)_httpd

意思是选择一个安装,这里选择apache2来安装

guoyanzhang@debian:~/test$ sudo apt-get install apache2
guoyanzhang@debian:~/test$ sudo apt-get install apache2-dev

2,查看安装是否成功

sudo systemctl status apache2

debian10安装httpd服务器(命令行安装)_apache_02


在浏览器输入localhost或者本机的ip,测试成功。

默认是放在/var/www/html/,用http访问。

3,测试:

初始访问的是一个叫index.html的文件,我现在改成test.html

debian10安装httpd服务器(命令行安装)_html_03

访问:

debian10安装httpd服务器(命令行安装)_http_04

debian10安装httpd服务器(命令行安装)_debian_05

三,修改服务器根目录:

1,sudo vim sites-available/000-default.conf

debian10安装httpd服务器(命令行安装)_apache_06

2,sudo vim apache2.conf

debian10安装httpd服务器(命令行安装)_http_07

3,sudo /etc/init.d/apache2 restart

debian10安装httpd服务器(命令行安装)_debian_08

4,测试:

debian10安装httpd服务器(命令行安装)_apache_09

网页访问:

debian10安装httpd服务器(命令行安装)_html_10

参考2:​​https://www.jianshu.com/p/acc560204a4d​