给公司配置PHP服务器,用apache进行操作,遇到如标题那个问题,无法进行远程HTTP请求,解决办法如下
apach/conf/httpd.conf文件修改如下:
<Directory />
Options FollowSymLinks
AllowOverride all
Require local
</Directory>
修改为:
<Directory />
Options FollowSymLinks
AllowOverride none
Require all granted
</Directory>
以及下方的
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options FollowSymLinks
AllowOverride all
Require local
</Directory>
修改为:
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</Directory>
此时还是不行,被干的稀碎,参考大佬原帖:https://bbs.csdn.net/topics/390904273?list=23494857
但是他可能没提醒用户httpd-vhosts.conf也要改,路径在apach/conf/extra/httpd-vhosts.conf里面
将
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride all
Require local
</Directory>
</VirtualHost>
修改为:
# Virtual Hosts
#
<VirtualHost *:80>
#ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
然后重启apache,成功。
希望文章对你有帮助