wliam0807

Q: I cant get Apache configure correctly El Capitan

Hi, I'm new to the forums and coding on a mac os x. I am trying to start coding in PHP and have gone through several guides to configure apache2 so that I can access my 'Sites' directory through my web browser. I have followed several configuration guides to configure my system but after making the changes to several files (httpd.conf, etc.) I still get the message Unable to Connect when accessing my localhost through browser.

 

No matter what I do when I try to access my local host through the web browser it says Unable to Connect. I have recently upgraded from Mavericks to El Capitan 10.11.6. I have no idea where to go from here, can someone please point me in the right direction, on how to configure Apache so that I access my localhost directory and begin programming in php.

MacBook Pro

Posted on Aug 17, 2016 4:45 PM

Close

Q: I cant get Apache configure correctly El Capitan

  • All replies
  • Helpful answers

  • by etresoft,Helpful

    etresoft etresoft Aug 20, 2016 5:20 PM in response to wliam0807
    Level 7 (29,031 points)
    Aug 20, 2016 5:20 PM in response to wliam0807

    Hello wliam0807,

    Did you go through this guide? Setting up a local web server on OS X

  • by wliam0807,

    wliam0807 wliam0807 Aug 21, 2016 10:57 AM in response to etresoft
    Level 1 (8 points)
    Aug 21, 2016 10:57 AM in response to etresoft

    I just went through the guide followed everything step by step. Still getting the 'Unable to Connect' message.

     

    I tried accessing it through http://MacBook-Pro.local, and received the UtC (unable to connect) message

    I also tried http://<your-local-host>, still nothing.

     

    I even tried enabling File Sharing but I'm still not able to connect and see the "It Works!" message.

     

    In Terminal I ran the command: apachectl configtest and this is what it returned:

     

    'AH00526: Syntax error on line 20 of /private/etc/apache2/extra/httpd-mpm.conf:

    Invalid command 'LockFile', perhaps misspelled or defined by a module not included in the server configuration'


    What should I do? Appreciate your help

  • by wliam0807,

    wliam0807 wliam0807 Aug 21, 2016 12:38 PM in response to wliam0807
    Level 1 (8 points)
    Aug 21, 2016 12:38 PM in response to wliam0807

    Ok so I solved part of the problem. I am now able to access http://macbook-pro.local and it shows the message 'It Works!' instead of the unable to connect. I did this by commenting out the following lines in: etc/apache2/extra/httpd-mpm.conf

     

    # The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
    #
    <IfModule !mpm_winnt_module>
    <IfModule !mpm_netware_module>
      LockFile "/private/var/log/apache2/accept.lock"
    </IfModule>
    </IfModule>


    I commented out the above lines and it has allowed me to connect to part of the server.

     

    Now I still have a problem. When I try to connect to http://localhost/~<username>/ I get a '403 Forbidden' message saying 'You don't have permission to access /~<username> on this server.

     

    After running apachectl -t this is the message Terminal returns:

     

    AH00548: NameVirtualHost has no effect and will be removed in the next release /private/etc/apache2/extra/httpd-vhosts.conf:19

    AH00112: Warning: DocumentRoot [/Users/~Programming/Sites/] does not exist

    AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using MacBook-Pro.local. Set the 'ServerName' directive globally to suppress this message

    Syntax OK

    --------

     

    How can I resolve this issue now?

  • by etresoft,

    etresoft etresoft Aug 21, 2016 4:49 PM in response to wliam0807
    Level 7 (29,031 points)
    Aug 21, 2016 4:49 PM in response to wliam0807

    Hello wliam0807,

    It looks like your Apache config files were not upgraded as they should have been. I suggest you make a backup and then reinstall the operating system. You shouldn't have to erase the disk. Just reinstall on top of whatever you have.