一,介紹
之前的http配置文件都在http.conf裏面,現在都是在apache2.conf裏面,並且只是一個彙總。
/etc/apache2$ ls apache2.conf
apache2.conf
二,安裝httpd服務器
1,在終端執行
guoyanzhang@debian:~/test$ sudo apt-get install httpd
輸出如下信息
意思是選擇一個安裝,這裏選擇apache2來安裝
guoyanzhang@debian:~/test$ sudo apt-get install apache2
guoyanzhang@debian:~/test$ sudo apt-get install apache2-dev
2,查看安裝是否成功
sudo systemctl status apache2
在瀏覽器輸入localhost或者本機的ip,測試成功。
默認是放在/var/www/html/,用http訪問。
3,測試:
初始訪問的是一個叫index.html的文件,我現在改成test.html
訪問:
三,修改服務器根目錄:
1,sudo vim sites-available/000-default.conf
2,sudo vim apache2.conf
3,sudo /etc/init.d/apache2 restart
4,測試:
網頁訪問:
參考1:https://blog.csdn.net/heiheiya/article/details/90693940