Localhost说 - 它可以工作,但这些Localhost / phpmyadmin和localhost /〜用户名:
Safari无法与服务器
连接
我不使用MAMP。我另外安装了MySQL,我下载了Phpmyadmin并将此文件夹放到了Sites。
我的httpd-vhosts.confg有
# Virtual Hosts
#
# Required modules: mod_log_config
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
DocumentRoot "/Users/bereshka/Sites/parustrans"
ServerName parustrans.local
</VirtualHost>
我的主人有
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 parustrans.local
my users/bereshka.conf has
<Directory "/Users/bereshka/Sites/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Require all granted
</Directory>
我的httpd.confg有
答案 0 :(得分:0)
看起来我自己找到了解决方案。想与所有面对同样的人分享。我做的步骤:
我将httpd.confg,httpd-vhosts.confg,hosts,username.confg中的代码替换为来自相同文件的代码,但是替换了其他mac,其中从未使用apache进行任何工作。因为最近几天我一直在编辑这么多次,我已经失去了修复它的希望))它让我从零开始。这一步解决了“Safari无法与服务器连接”的问题,但当我使用localhost / ~username时出现其他错误我得到404 Not Found
我在httpd.confg
中取消注释了这些行LoadModule authz_core_module libexec / apache2 / mod_authz_core.so LoadModule authz_host_module libexec / apache2 / mod_authz_host.so LoadModule userdir_module libexec / apache2 / mod_userdir.so LoadModule include_module libexec / apache2 / mod_include.so LoadModule rewrite_module libexec / apache2 / mod_rewrite.so LoadModule php5_module libexec / apache2 / libphp5.so
检查此article以获取所有步骤的详细说明
但是此操作(在我的情况下)再次返回此错误 - “服务器无法连接..”。我在评论中发现上面提到的文章,如果要回复这一行可能会解决 - LoadModule php5_module libexec / apache2 / libphp5.so我做到了(我在mac Sierra 10.12.6上)
这有帮助))但是当我检查localhost / ~username时,我收到了一个新的错误403 Forbidden by link localhost / ~username。但是当我只键入localhost时 - 它有效。
这显然是权限和用户的问题。所以我在文件夹apache2 / users中检查了我的两个文件username.conf和bereshka.conf,我设置了这个代码(对于Apache 2.4)而不是那里的所有内容(/ Users / bereshka / Sites /相应)
AllowOverride All 选项索引MultiViews FollowSymLinks 要求全部授予
这个不起作用
<Directory "/Users/username/Sites/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
这是apache 2.2