apache设置虚拟主机访问403禁止访问,为什么?
The environment is OS X 10.10.2 Yosemite and I'm running a XAMPP server. my configurations:
httpd.conf
<Directory />
#Options FollowSymLinks
#Require all granted
AllowOverride All
#XAMPP
Order deny,allow
Allow from all
</Directory>
<Directory "/Applications/XAMPP/xamppfiles/htdocs">
Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
# Virtual hosts
Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf
httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin luckyyulin@sina.cn
DocumentRoot "/Applications/XAMPP/htdocs/makefriend99/1"
ServerName makefriend99.com
ServerAlias www.makefriend99.com
ErrorLog "logs/makefriend99/error_log"
CustomLog "logs/makefriend99/access_log" common
<Directory /Applications/XAMPP/htdocs/makefriend99/1>
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin luckyyulin@sina.cn
DocumentRoot "/Applications/XAMPP/htdocs/angular"
ServerName ngaction.com
ServerAlias www.ngaction.com
ErrorLog "logs/angular/error_log"
CustomLog "logs/angular/access_log" common
<Directory /Applications/XAMPP/htdocs/angular>
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
hosts
127.0.0.1 makefriend99.com
127.0.0.1 ngaction.com
I access makefriend99.com is successful before adding ngation.com, besides localhost/makefriend99/1.But It’s failed to access ngation.com,localhost/makefriend99/1 and localhost/angular of 403 access forbidden after adding ngaction.com, makefriend99.com is successful,access localhost to makefriend99.com. I have tried some ways saw in the Internet,but I haven’t solved the problem,who can help me to explain why and give some answers to solve it?
环境是OS X 10.10.2 Yosemite,我正在运行XAMPP服务器。 配置: p>
httpd.conf strong> p>
httpd-vhosts.conf strong> p>
主机 strong> p>
我在添加ngation.com之前访问makefriend99.com是成功的,除了localhost / makefriend99 / 1.但是它无法访问ngat 添加了ngaction.com后禁止进入ion.com,localhost / makefriend99 / 1和localhost / angular of 403 access
,makefriend99.com成功,访问localhost to makefriend99.com。
我尝试了一些在互联网上看到的方法,但是 我还没有解决问题,谁可以帮我解释原因并给出一些答案来解决它? p>
div>
&lt; Directory /&gt;
#Options FollowSymLinks
#Require all all
AllowOverride All
#XAMPP
订单拒绝,允许
允许来自所有
&lt; /目录&gt;
&lt;目录“/ Applications / XAMPP / xamppfiles / htdocs”&gt;
选项索引FollowSymLinks ExecCGI包含
AllowOverride All
订单允许,拒绝
允许所有人
需要所有授权
&lt; /目录&gt;
#虚拟主机
包括/Applications/XAMPP/etc/extra/httpd-vhosts.conf
pre>
&lt; VirtualHost *:80&gt;
ServerAdmin luckyyulin @ sina.cn
DocumentRoot“/ Applications / XAMPP / htdocs / makefriend99 / 1”
ServerName makefriend99.com
ServerAlias www.makefriend99.com
ErrorLog“logs / makefriend99 / error_log”
CustomLog“logs / makefriend99 / access_log“common
&lt; Directory / Applications / XAMPP / htdocs / makefriend99 / 1&gt;
选项FollowSymLinks
AllowOverride无
命令拒绝,允许
允许来自所有
&lt; / Directory&gt;
&lt; / VirtualHost&gt;
&lt; VirtualHost *:80&gt;
ServerAdmin luckyyulin@sina.cn
DocumentRoot“/ Applications / XAMPP / htdocs / angular”
ServerName ngaction.com
ServerAlias www.ngaction.com
ErrorLog“ logs / angular / error_log“
CustomLog”logs / angular / access_log“common
&lt; Directory / Applications / XAMPP / htdocs / angular&gt;
选项FollowSymLinks
AllowOverride无
命令拒绝,允许
允许所有
&lt; /目录&gt;
&lt; / VirtualHost&gt;
code> pre>
127.0.0.1 makefriend99.com
127.0.0.1 ngaction.com
code> pre>
First, this question may answer it: https://stackoverflow.com/a/24665604/3990714 and this: https://stackoverflow.com/a/9117898/3990714
If the first didn't work, try this:
[Note: I don't use XAMPP so this step is probably irrelevant and you may want to customly CHMOD all the subdirectories in your XAMPP file]: Somewhere along the lines, Apple moved the Apache WebServer folder and a bunch of permission errors arose resulting in the 403 Access Forbidden Error (me included).
I had this issue specifically with my localhost, but I assume it will be the same concept here.
In your terminal: Go to the Home directory via:
$ cd
Then we will go up the directory tree.
$ cd ../../
To get to the Macintosh HD disk (root directory). Then:
$ cd Library
If you type the ls
command you should see everything. Then chmod from the prior link (seen here) to the WebServer folder. You may have to chmod all subdirectories in that folder too, but I didn't encounter that issue when I experienced this error.
I see, both of them are running at the same IP. If they also run on the same port, you have to change the port of one of them.
How about trying to permit an access by adding the Require all granted
directive to a specific VirtualHost
Directory
?
...
#Order deny,allow <- You can try to remove this
#Allow from all <- and that if they're just a crap.
Require all granted
</Directory>
</VirtualHost>
<Directory />
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order deny,allow
Allow from all
</Directory>