Just use the MAC when configured once the Mac comes with Apache, the main is usually their own mackdown to write documents, loaded into HTML files under Apache to facilitate their own and colleagues to read. Later upgrade a variety of things, it is estimated that the upgrade OS X led to Apache can not be used, and toss a day to fix it (Apache small white hurt AH), now sorted out to facilitate the subsequent occurrence of similar things can be quickly done.
The Apache default installation path is /etc/apache2/ .
The Apache default host path is /library/webserver/documents .
Apache Default User path is ~/sites (this path if not to manually create, such as my user name is Qyfmac, this path is/users/qyfmac/sites).
If you put all the files in the/library/webserver/documents, sudo is required for each modification, and all of the files are placed under ~/sites. However, the file under the ~/sites to do some configuration work, the following we began to configure.
1. Modify the /etc/apache2/httpd.conf file. Find the following lines of code to remove the previous # number.
LoadModule authz_core_module libexec/apache2/mod_authz_core.soloadmodule authz_host_module libexec/ apache2/mod_authz_host.soloadmodule userdir_module libexec/apache2//private/etc/apache2/extra/ Httpd-userdir.conf
2. Modify the /etc/apache2/extra/httpd-userdir.conf file. Locate the following line of code and remove the previous # number.
Include/private/etc/apache2/users/*. conf
3. Modify the /etc/apache2/users/qyfmac.conf file. If the file does not exist, create one, my qyfmac is my user name, can be created according to different users. The file contents are as follows
" /users/qyfmac/sites/ "> Options Indexes multiviews allowoverride None Order allow,deny allow from all Require all granted</Directory>
Good configuration is done, let's launch Apache below.
Stop Apache command: sudo apachectl stop
Start Apache command: sudo apachectl start
Restart Apache command: sudo apachectl restart
After successful launch, visit http://localhost and Http://localhost/~qyfmac to see the effect.
Finally stressed, Qyfmac is my username, you crossing yourself to make the time remember to change it to your own username.
There is also my files are static HTML, no secrets, so Apache access to do not control, anyone can access. If you need permission control, consult the Apache documentation.
Enable Mac (OS X Yosemite) comes with Apache