1. 程式人生 > >ubuntu apache 通過端口新建多個站點

ubuntu apache 通過端口新建多個站點

width idt root vim png tar clu light .com

cd /etc/apache2/sites-available

最近的虛擬機沒綁定域名,所以呢,就先用域名加端口新建幾個站點用著

1、

 vim /etc/apapche2/apapche2.conf

# Include list of ports to listen on
Include ports.conf
找到了這個,打開這個添加監聽端口

vim ports.conf

2、添加8080端口,或者其他的你想要的端口

技術分享圖片

3、添加主機配置文件,復制一個你以前的配置過得文件,我以前就配過一個,然後直接修改就好了。

cd /etc/apache2/sites-available
vim test.con

只修改端口和DocumentRoot的目錄和其他的目錄就好了。

技術分享圖片

4、發布新站點

sudo ln -s /etc/apache2/sites-available/test.conf /etc/apache2/sites-enabled/test.conf

創建好了新站點的配置文件,要讓他們生效們還必須將配置文件軟鏈接到 sites-enabled 文件夾中。

5、重啟apache

systemctl restart apache2

重新啟動APACHE服務器。
打開瀏覽器 訪問 http://xxxx:8080能訪問正確,說明就配置好了有點廢話,哈哈哈,,但是要在根目錄創建好你再配置文件中DocumentRoot路徑的文件,:)

ubuntu apache 通過端口新建多個站點