[請益] Apache 新增虛擬主機

看板PHP作者時間10年前 (2015/02/07 17:59), 10年前編輯推噓0(005)
留言5則, 2人參與, 最新討論串1/2 (看更多)
打擾了各位先進 小弟想要新增一個虛擬主機到 /home/user/example 但是似乎是失敗了,也不知道怎樣算是新增成功。 以下是新增的作法 在/apache2/sites-available下新增example.conf 以下為檔案內容 <VirtualHost *:80> ServerAdmin webmaster@example DocumentRoot /home/user/example <Directory /home/user/example> Options all AllowOverride all Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> -------------------------------------------------- /home/user/example跟裡面index.php的own user, grp www-data, mod 755 都一樣 結果 a2ensite enabled apache2 也restart OK 不曉得怎樣才算是新增成功,也不知道要輸入什麼網址去跑example下的index.php 谷歌兩天了還是無法成功,所以想請問一下有什麼其他的建議..... -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 182.235.169.247 ※ 文章網址: https://www.ptt.cc/bbs/PHP/M.1423303185.A.08D.html ※ 編輯: olop (182.235.169.247), 02/07/2015 18:01:09

02/07 18:44, , 1F
對應網址或IP~若是在本機測試~設定設另一組IP對應即可
02/07 18:44, 1F

02/07 18:45, , 2F
<VirtualHost *:80>改<VirtualHost 192.168.1.2:80>
02/07 18:45, 2F

02/07 18:46, , 3F
對應外部網址改<VirtualHost xxx.com.tw:80>
02/07 18:46, 3F

02/07 18:47, , 4F
不同網址或IP對應不同的目錄~Google搜尋有一推教學跟說明
02/07 18:47, 4F

02/07 18:56, , 5F
*替代成ip就可以了 感謝回答....
02/07 18:56, 5F
文章代碼(AID): #1KrU8H2D (PHP)
文章代碼(AID): #1KrU8H2D (PHP)