skip to Main Content

I know there are dozens of questions about Apache not working, but nothing seems to solve it for me. I’m on macOS Big Sur 11.0.1.

I installed Apache with brew install httpd and then brew services start httpd. Everything seems to be okay, but going to http://localhost/ gives me "This site can’t be reached" error. http://127.0.0.1/ also gives that error. My /etc/hosts configuration seems to be fine.

I don’t understand what’s wrong. What can I do to find out the issue?

5

Answers


  1. I find that

    apachectl stop
    
    
    apachectl start
    

    is the more reliable way to ensure httpd is running successfully. Also always

    tail -f /usr/local/var/log/httpd/error_log
    
    Login or Signup to reply.
  2. I assume you have tried to follow https://getgrav.org/blog/macos-bigsur-apache-multiple-php-versions tutorial. If not no worries. I followed this tutorial and I got the same issue.

    As per my understanding you have updated to BigSur from previous version and there you have used sudo to install apache and php etc. Now it will not work due to permission issues.

    I am able to make it run with the following steps

    1. Change Listen 80 to Listen 127.0.0.1:80 in /usr/local/etc/httpd/httpd.conf
    2. use sudo /usr/local/bin/httpd -k start to start your httpd

    Rest follow the tutorial to install multiple versions of PHP, enabling PHP in httpd.conf file and PHP version switcher. After switching the version you must stop and start the httpd via sudo command i mentioned above.

    So looks like things are working with this. I hope if I’m able to set proper permissions then I no longer need the sudo. And if you are at the tutorial, please check the comments at the bottom

    Take care

    Login or Signup to reply.
  3. @Robo Robok

    apachectl stop gives me: /System/Library/LaunchDaemons/org.apache.httpd.plist: Could not find specified service. Unload failed: 113: Could not find specified service

    Solution:

    1. sudo apachectl start
      first start the server
    2. sudo apachectl stop
      then you can stop it
    Login or Signup to reply.
  4. I have same issue, I upgrade from catalina to big sur, apache is well for a month, then a restart, apache isn’t working.

    I follow above,

           Change Listen 80 to Listen 127.0.0.1:80 in /usr/local/etc/httpd/httpd.conf
    
         
    

    This only make things worse.

    I reinstall apache use brew https://getgrav.org/blog/macos-bigsur-apache-multiple-php-versions

    same problem, not works above.

    Finally, I change back Listen 10,

    and

        sudo apachectl -k restart
    

    make it works again.

    Brew services list is wrong, misleading, not trust.

    if I run

          brew services list
    

    I got :

         Name  Status  User   Plist
         httpd error   root   /Library/LaunchDaemons/homebrew.mxcl.httpd.plist
         mysql started gemini /Users/gemini/Library/LaunchAgents/homebrew.mxcl.mysql.plist
                 
    

    You can see httpd is error, in fact, my apache runs well,
    so the info here is all wrong.

     !!!!!! if apache is not working !!!!!!
     
                  run following to fix:
            
                            sudo apachectl -k stop
                            sudo apachectl -k start
    
                                   or 
                      
                            sudo apachectl -k restart
                   
                   
                   
                  Check log:        
    
                            tail -f /usr/local/var/log/httpd/error_log
    
         
     !!!!!! if apache is not working !!!!!!
    
                
                
                
                
                
                
                
     
                change default port to 10:
                
                            
                     edit file: 
                     
                             /usr/local/etc/httpd/httpd.conf
                             
                             change to  Listen : 10
                             
                             
    
                     server root directory: 
     
                                         DocumentRoot "/usr/local/var/www"       
            
            
            
            
    
    Login or Signup to reply.
  5. $ brew update
    $ brew install apache2
    $ sudo apachectl start
    

    Access the index page at http://localhost:80 or by simply visiting localhost on the browser.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search