As morth pointed out, for the default Mac OS X Apache installation these are located in: /var/log/apache2/error_log.
The location can be changed in the httpd config using the ErrorLog directive, even for individual virtual hosts. Also note that if you installed another Apache besides the built-in one (like through MacPorts, or MAMP), this probably is ...
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.
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.
OS X provides launchctl to control which daemons are started at boot time.
To stop and disable Apache:
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 ...
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 ...
Here is how you can re-enable the web page with the command line using Terminal.
First copy this and paste it into Terminal. You may have to press enter after pasting to run it. It will ask for your password because it is adding a file to your system directory.
USER_DIR=$(basename $(echo ~))
sudo bash -c "cat > /etc/apache2/users/$USER_DIR.conf" <&...
Find the line that says LoadModule php5_module libexec/apache2/libphp5.so and uncomment it by editing out the # at the beginning of the line. (Then save the file, obviously.)
Go to Terminal and type sudo apachectl graceful at the console:
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:
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....
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, ~/....
Instead of guessing which php.ini you need to alter, run this command to locate the file:
php -r 'phpinfo();' | grep 'php.ini'
Even though I use MAMP PRO, by default my command-line PHP commands are not executed using their copy of PHP. In my case it says the file is found at /etc/php.ini
Once you have located the file, follow the instructions on all of ...
/etc/php.ini.default serves only as a reference and is not read out by PHP at all. The built-in PHP installation will look for the file /etc/php.ini instead. This file is not present by default, but you can copy /etc/php.ini.default to /etc/php.ini and make your modifications in there. You could also just create an empty file and only add any directives you ...
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.
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
sudo /usr/sbin/apachectl start
To start apache
sudo apachectl start
This will give you a basic Apache server with a DocumentRoot at /Library/WebServer/Documents/
You can enable things like PHP and virtualhosts by making use of the configuration file, which must be edited as root:
Restart the apache server (like after editing the config file) with
sudo apachectl ...
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:
Solution was to delete this pid file and then httpd started.
You should make sure that in your /etc/apache2/users/username.conf you have the following:
Options Indexes MultiViews FollowSymlinks
Allow from all
The FollowSymlinks and AllowOverride are essential here. While you are hinting at both in your ...
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.
2)**And edit your "/etc/apache2/httpd.conf"
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:
sudo mv httpd.conf httpd.conf-afterupdate
sudo mv httpd.conf.pre-update httpd.conf
sudo apachectl configtest
sudo apachectl restart
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 ...
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.:
And then restart Apache:
$ sudo apachectl restart
If you have active sessions, they are going ...
There should be 3 files in /Library/WebServer/Documents:
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.
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.
1. How do you configure your vhosts?
The "Lion way" to do so would be uncommenting the following line in your httpd.conf.
Now you can edit /private/etc/apache2/extra/httpd-vhosts.conf and put your vhosts in there. It's a good idea to start with a default one that will match all unqualified hosts, for ...
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, ...
This worked for me when I ran into the same problem.
Please check "/private/etc/apache2/extra/httpd-userdir.conf" file.
and restart apache.
Generate a host key
First, make a home for the new SSL files. I use /etc/apache2/ssl. Open up a terminal window, cd to the new directory and issue the following command to create a host key file.
sudo ssh-keygen -f host.key
Generate a certificate request file
This command create a certificate request file. A certificate request file contains information ...
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.
In that post, the author, Josh, suggested restarting apache using the following command:
sudo bash -x /usr/sbin/...
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,
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
Then edit the file /usr/local/etc/apache2/2.4/extra/httpd-vhosts.conf to suit ...
I have solved the problem by restoring my Hosts file (it was empty):
But before, you have to check your hosts file.
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 ...