Ana Gud Ana Gud - 5 months ago 27
Apache Configuration Question

Localhost on mac doesn't work / Server can't connect / 404 Not found / 403 Forbidden

Localhost says - It works, but these Localhost/phpmyadmin and localhost/~username:

Safari Can't connect with Server

I don't use MAMP. I installed additionally MySQL and I downloaded Phpmyadmin and placed this folder to Sites.

my httpd-vhosts.confg has

# 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:>
# 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

my hosts has

# Host Database
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
## localhost broadcasthost
::1 localhost parustrans.local
my users/bereshka.conf has

<Directory "/Users/bereshka/Sites/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Require all granted

my httpd.confg has

Answer Source

Looks like I found the solution myself. Want to share it with all who face the same. Steps that I did:

  1. I replaced the code in httpd.confg , httpd-vhosts.confg , hosts, username.confg to the code from the same files, but of other mac, where has never been done any works with apache. Because for last few days I was editing all that so many times and I already lost the hope to fix it)) It let me to start all from zero. This step solved the problem "Safari Can't connect with Server" , but other error appeared when I go by localhost/~username I get 404 Not Found

  2. I uncommented these lines in httpd.confg

    LoadModule authz_core_module libexec/apache2/ LoadModule authz_host_module libexec/apache2/ LoadModule userdir_module libexec/apache2/ LoadModule include_module libexec/apache2/ LoadModule rewrite_module libexec/apache2/ LoadModule php5_module libexec/apache2/

check this article for detailed description of all steps

  1. But this action (in my case) returned again this error - "Server cannot connect.." . I found under above mentioned article in comments that it might be solved if to comment back this line - LoadModule php5_module libexec/apache2/ and I did that (I'm on mac Sierra 10.12.6)

  2. That helped )) but when I checked localhost/~username I got a new error 403 Forbidden by link localhost/~username. But when I typed only localhost - It works.

  3. It's obviously problems with permissions and user. So I checked my two files username.conf and bereshka.conf in the folder apache2/users and I set this code (for Apache 2.4) instead of all what was there (/Users/bereshka/Sites/ accordingly)

    AllowOverride All Options Indexes MultiViews FollowSymLinks Require all granted

this one doesn't work

<Directory "/Users/username/Sites/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all

It's for apache 2.2

  1. Now I can see the list of folders in Sites, next task is to install Joomla, but it's another story :)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download