国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > 幫助中心 > 正文

Mac配置虛擬主機詳細過程

2020-03-22 19:57:32
字體:
來源:轉載
供稿:網友
一、啟動Apache本文主要講述了

終端輸入:sudo apachectl start

Apache的安裝目錄在:/etc/apache2/,etc默認是隱藏的。有三種方式查看:

1.桌面位于Finder時:shift+command+g,輸入“/etc”(即Finder-前往-前往文件夾的快捷鍵

2.打開終端:cd /etc

3.可以在terminal 輸入 open /etc

二、設置html' target='_blank'>虛擬主機

1.在終端運行“sudo vi /etc/apache2/httpd.conf”,打開Apche的配置文件

2.在httpd.conf中找到“#Include /private/etc/apache2/extra/httpd-vhosts.conf”,去掉前面的“#”,保存并退出。

3.運行“sudo apachectl restart”,重啟Apache后就開啟了虛擬主機配置功能。

4.運行“sudo vi /etc/apache2/extra/httpd-vhosts.conf”,就打開了配置虛擬主機文件httpd-vhost.conf,配置虛擬主機了。需要注意的是該文件默認開啟了兩個作為例子的虛擬主機

 VirtualHost *:80 ServerAdmin webmaster@dummy-host.example.com DocumentRoot /usr/docs/dummy-host.example.com ServerName dummy-host.example.com ErrorLog /private/var/log/apache2/dummy-host.example.com-error_log CustomLog /private/var/log/apache2/dummy-host.example.com-access_log common  /VirtualHost  VirtualHost *:80 ServerAdmin webmaster@dummy-host2.example.com DocumentRoot /usr/docs/dummy-host2.example.com ServerName dummy-host2.example.com ErrorLog /private/var/log/apache2/dummy-host2.example.com-error_log CustomLog /private/var/log/apache2/dummy-host2.example.com-access_log common  /VirtualHost 

而實際上,這兩個虛擬主機是不存在的,在沒有配置任何其他虛擬主機時,可能會導致訪問localhost時出現如下提示:
Forbidden
You don t have permission to access /index.php on this server

最簡單的辦法就是在它們每行前面加上#,注釋掉就好了,這樣既能參考又不導致其他問題。

5.增加如下配置,支持localhost訪問,添加虛擬主機訪問

 VirtualHost *:80 DocumentRoot /Library/WebServer/Documents ServerName localhost ErrorLog /private/var/log/apache2/localhost-error_log CustomLog /private/var/log/apache2/localhost-access_log common  /VirtualHost  VirtualHost *:80 DocumentRoot /Library/WebServer/Documents ServerName 虛擬主機地址 (如:www.test.com)ErrorLog /private/var/log/apache2/test-error_log CustomLog /private/var/log/apache2/test-access_log common  Directory / Options Indexes FollowSymLinks MultiViews AllowOverride None Order deny,allow Allow from all  /Directory  /VirtualHost 

保存,退出,重啟Apache。

6.運行“sudo vi /etc/hosts”,打開hosts配置文件,加入 127.0.0.1 www.test.com ,這樣就可以配置完成test虛擬主機了。

打開瀏覽器,輸入:www.test.com

It works!

配置成功,和localhost一致!

推薦課程:PHP視頻教程

以上就是Mac配置虛擬主機詳細過程的詳細內容,PHP教程

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 皮山县| 牡丹江市| 新绛县| 济南市| 上犹县| 贵阳市| 甘德县| 南川市| 措美县| 莲花县| 高邑县| 樟树市| 泸水县| 南平市| 武威市| 溧水县| 临湘市| 无极县| 四川省| 福贡县| 托克逊县| 蒙山县| 宁明县| 赤峰市| 镇宁| 乌恰县| 行唐县| 龙口市| 林西县| 灵璧县| 贞丰县| 庆元县| 略阳县| 涿鹿县| 辉南县| 乡宁县| 芦山县| 越西县| 田阳县| 金华市| 乡城县|