[英]Apache VirtualHosts don't work no matter what
我試過很多方法,我已經研究了一噸的StackOverflow上的問題和他們沒有工作! 一些信息:
這是我嘗試過的網站:
添加VirtualHost失敗:禁止訪問錯誤403(XAMPP)(SO)
虛擬主機不起作用-WebmasterWorld上的Apache Web服務器論壇
我的VirtualHosts文件:
<VirtualHost wrks.tk:80>
DocumentRoot "/Apps/XAMPP/htdocs/DNS"
ServerName wrks.tk
ErrorLog "/Logs/wrks.tk-error.log"
CustomLog "/Logs/wrks.tk-access.log" common
<Directory "/Apps/XAMPP/htdocs/DNS">
AllowOverride All
Order Allow,Deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
實際加載的內容(這是httpd.conf文件中的defualt目錄,即“ backup”目錄):
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
<Directory "/Applications/XAMPP/xamppfiles/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/trunk/mod/core.html#options
# for more information.
#
#Options Indexes FollowSymLinks
# XAMPP
Options Indexes FollowSymLinks ExecCGI Includes
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
#AllowOverride None
# since XAMPP 1.4:
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
我要檢查的幾件事情是:
確保包含httpd-vhosts.conf
# Virtual hosts
Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf
設置主機:
在文本編輯器中導航到Macintosh HD / private / etc / hosts,然后單擊“打開”。 然后添加以下行:
127.0.0.1 wrks.tk
也許嘗試:
<VirtualHost *:80>
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/DNS"
ServerName wrks.tk
ErrorLog "/logs/wrks.tk-error_log"
CustomLog "/logs/wrks.tk-access_log" common
</VirtualHost>
您可能還想再次設置localhost。
<VirtualHost *:80>
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
ServerName localhost
</VirtualHost>
抱歉,如果其中某些路徑不正確,則需要根據xamp文件夾結構進行檢查。
我發現的最簡單的實現是: http : //iwearshorts.com/blog/adding-a-virtual-host-vhost-in-xampp-on-a-mac/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.