Hot answers tagged

39

Had the same problem. I deleted one of my project's folder and it became broken. In this case the site's configs should be removed from httpd-vhosts.conf and httpd.conf. Try ping 127.0.0.1 apachectl configtest can help you to detect the problem.


35

OS X provides launchctl to control which daemons are started at boot time. To stop and disable Apache: Open Terminal Type the following command (type your login password when sudo requests it): sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist A few words on launchctl's -w option The -w option is the silver bullet for ...


34

LockFile is one of the directives of Apache ≤ 2.2. This was replaced by Mutex in Apache 2.4, which is the version of Apache installed with OS X 10.11, El Capitan. Edit the file /etc/apache2/extra/httpd-mpm.conf to remove this part: # # The accept serialization lock file MUST BE STORED ON A LOCAL DISK. # <IfModule !mpm_winnt_module> <IfModule !...


23

I have an alias specified in OSX server pointing to a user directory. I spent a long while chmodding and messing with _www user, adding executable permissions recursively, uninstalling macports and all sorts of stuff trying to get this to work. No idea why it wasn't working. Eventually, I just checked the "shared folder" checkbox in the Finder for that ...


22

Removing system macOS binaries is not a good idea, they will be reinstalled during a next system upgrade and they could be needed by some system scripts. To enable the homebrew php from the command line, read the output of brew info php70: If you wish to swap the PHP you use on the command line, you should add the following to ~/.bashrc, ~/.zshrc, ~/....


17

In my opinion you hosed your various httpd launch daemons/start mechanisms by executing too many httpd related commands. With homebrew and homebrew's apache-httpd installed and the default PATH you have six ways to start httpd. Apple's Apache: sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist sudo /usr/sbin/apachectl start ...


17

Regarding homebrew httpd, one issue I recently ran into was an old leftover httpd.pid file that was preventing httpd from starting. Symptom was apachectl start said httpd is already running, but it was not. Cause was an old file here: /usr/local/var/run/httpd/httpd.pid Solution was to delete this pid file and then httpd started.


16

I looked up the information on the file http-mpm.conf at the Apache website: It says LockFile is a correct directive. I don't know why I'm getting the same error you are. So in terminal, I went to: /etc/apache2/extra and restored the httpd-mpm.conf file from before I loaded El Capitan. I used these commands: sudo mv httpd-mpm.conf httpd-mpm.conf....


12

I generally fix this by setting the Apache user to myself in local environments and in machines where the only user who uses Apache is me. In /private/etc/apache2/httpd.conf, set User to your username from _www, e.g.: User _www -> User joao And then restart Apache: $ sudo apachectl restart Additional steps: If you have active sessions, they are going ...


12

After updating to macOS Sierra, Apache httpd moves the old httpd.conf to httpd.conf.pre-update and place the new one. In order to work the localhost work please try the below procedure: cd /etc/apache2/ sudo mv httpd.conf httpd.conf-afterupdate sudo mv httpd.conf.pre-update httpd.conf sudo apachectl configtest sudo apachectl restart Then test: ...


12

When restart the httpd. Try: sudo /usr/sbin/apachectl restart Don't use: sudo apachectl restart


12

I want to view the status of a service in macOS using launchctl Hi, to view the status, use print: launchctl print system/org.apache.httpd Syntax is: launchctl print <domain>/<item> Domain can be: `system/<service>` `user/<UID>` `pid/<PID>` `session/<asid>` Various combinations and examples below: Use: ...


11

The answers above work great for the default apache that comes pre-installed on the mac. In my case, I'm using Apache (on High Sierrra) installed via Homebrew. Here's the procedure I used to locate my error log: >ps -ef |grep httpd This gives an output with lines like this: 502 10587 10586 0 11:11AM ?? 0:00.00 /usr/local/opt/httpd/bin/httpd -...


11

I had exactly the same problem. I started Apache without DocumentRoot(s). It did the trick. sudo apachectl -T


11

I update to macOSS Sierra, Version 10.12 I face the same issue, I did two things to fix it properly. Following is my approaches. 1) Please check "/private/etc/apache2/extra/httpd-userdir.conf" file. Change #Include /private/etc/apache2/users/*.conf to Include /private/etc/apache2/users/*.conf 2)**And edit your "/etc/apache2/httpd.conf" change ...


10

There should be 3 files in /Library/WebServer/Documents: index.html.en PoweredByMacOSX.gif PoweredByMacOSXLarge.gif If these files are missing, it really shouldn't matter. As soon as you create your own HTML file and place it in that folder, the "It works!" message should be replaced with your new index.html file. Hope this helps.


10

I had the same problem on a Sierra system. I run: which -a apachectl outputted: /usr/sbin/apachectl /usr/local/bin/apachectl to stop the apache by apple version: sudo /usr/sbin/apachectl stop To see the running processes: ps aux | grep httpd Outputted: ibook 1359 0,0 0,0 2432804 768 s000 S+ 4:13pm 0:00.00 grep httpd _www ...


10

I had the same problem - it's based on mod_userdir exclusion after updating to Mac OS X Mojave. There are a few steps to repair that: Load the module mod_userdir in /etc/apache2/httpd.conf At the end of the httpd.conf make sure to load httpd-userdir.conf In httpd-userdir.conf include a local file in /etc/apache2/users/<username>.conf Put a directory ...


9

I found a solution to your problem here. Using Terminal "How do I make Apache start automatically": sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist You were close to the solution just needed the -w override. the -w Overrides the Disabled key and sets it to false.


8

The file /etc/apache2/original/httpd.conf (in OS X 10.11.5) has the following content with three trailing empty lines: # # This is the main Apache HTTP server configuration file. It contains the # configuration directives that give the server its instructions. # See <URL:http://httpd.apache.org/docs/2.4/> for detailed information. # In particular, ...


8

I have solved the problem by restoring my Hosts file (it was empty): But before, you have to check your hosts file. cat /etc/hosts If nothing is shown, that means your hosts file is empty. Then just copy and paste this over the existing hosts file then save it as plain text to restore it. ## # Host Database # # localhost is used to configure the ...


8

This worked for me when I ran into the same problem. Please check "/private/etc/apache2/extra/httpd-userdir.conf" file. change #Include /private/etc/apache2/users/*.conf to Include /private/etc/apache2/users/*.conf and restart apache. From: https://stackoverflow.com/questions/39631351/apache-localhost-403-forbidden-with-macos-sierra


8

I think default apache path /etc/apache2/httpd.conf and homebrew apache path /usr/local/etc/httpd/httpd.conf And you may have 2 apache in your system use this cmd to check which -a apachectl apache for default /usr/sbin/apachectl apache for homebrew. I think so. /usr/local/bin/apachectl The command below use for default apache. I think. sudo ...


7

OK, so I found the culprit. It is amazing that no error message was visible in console or in the error logs, but I found a site which helped me a lot. http://blog.joshdick.net/2012/07/28/troubleshooting_apache_in_os_x_10.8_mountain_lion.html In that post, the author, Josh, suggested restarting apache using the following command: sudo bash -x /usr/sbin/...


7

I've seen similar just today, no logs and apache acted like it was started. The issue for me was a bad vhost file. sudo apachectl -S this allowed me to see the error


7

It looks like you have nearly everything correct. I'm running Mavericks with a couple dozen virtual hosts, so this should work for you. First, and this might be all you need to do to fix things, you need to enclose your DocumentRoot in quotes. So, DocumentRoot /Users/gdboling/Sites/rocket-gen becomes DocumentRoot "/Users/gdboling/Sites/rocket-gen" ...


7

You have to edit the file /usr/local/etc/apache2/2.4/httpd.conf. Search for and uncomment the following two lines (remove the # at the beginning of the line): #LoadModule vhost_alias_module libexec/mod_vhost_alias.so #Include /usr/local/etc/apache2/2.4/extra/httpd-vhosts.conf Then edit the file /usr/local/etc/apache2/2.4/extra/httpd-vhosts.conf to suit ...


7

Export your PATH with some like this (check your php version): export PATH=/usr/local/Cellar/php71/7.1.14_25/bin:$PATH


7

As the documentation suggests, you need to locate and edit the file: /opt/lampp/etc/extra/httpd-xampp.conf The hard part for me was locating this file. The solution I found was to ensure the stack volume was mounted: From there, you can click the explore button, which will open /opt/lampp/. You can then navigate to etc/extra/httpd-xampp.conf from the ...


Only top voted, non community-wiki answers of a minimum length are eligible