歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> 在ubuntu14.04 下,配置 apache2 的虛擬主機步驟

在ubuntu14.04 下,配置 apache2 的虛擬主機步驟

日期:2017/3/1 11:41:13   编辑:關於Linux
在ubuntu14.04 下,配置 apache2 的虛擬主機步驟,首先打開三個 terminal,並分別獲得 root 權限 在三個 terminal 中,分別進入 /etc/apache2 目錄

其中一個 terminal 進入 site-available 中並復制
000-default.conf 文件一份,重命名為需要的虛擬主機 target.conf

>$ cp site/available/000-default.conf target.conf

依次打開如下三個文件
apache2.conf
site-available/target.conf
ports.conf

在 site-available/target.conf 文件中,修改第一行的端口號為 xxxx,
以及 DocumentRoot 的所對應的路徑地址,然後保存退出

進入 site-available 目錄後,再執行

  >$ cd site-available
  >$ a2ensite target.conf
  >$ cd ../
在 ports.conf 文件中,第二行添加 Listen xxxx,其中 xxxx 為第5步中的端口號 在 apache2.conf 文件中,添加第5步中 DocumentRoot 對應路徑的權限信息,如

        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted

重啟 apache 服務器

It works

Copyright © Linux教程網 All Rights Reserved