天天看點

debian10安裝httpd伺服器(指令行安裝)

一,介紹

     之前的http配置檔案都在http.conf裡面,現在都是在apache2.conf裡面,并且隻是一個彙總。

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

二,安裝httpd伺服器

1,在終端執行

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

輸出如下資訊

debian10安裝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伺服器(指令行安裝)

在浏覽器輸入localhost或者本機的ip,測試成功。

預設是放在/var/www/html/,用http通路。

3,測試:

初始通路的是一個叫index.html的檔案,我現在改成test.html

debian10安裝httpd伺服器(指令行安裝)

通路:

debian10安裝httpd伺服器(指令行安裝)
debian10安裝httpd伺服器(指令行安裝)

三,修改伺服器根目錄:

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

debian10安裝httpd伺服器(指令行安裝)

2,sudo vim apache2.conf

debian10安裝httpd伺服器(指令行安裝)

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

debian10安裝httpd伺服器(指令行安裝)

4,測試:

debian10安裝httpd伺服器(指令行安裝)