If you only need to use Apache in the user directory, there is also the simplest way to direct the httpd.conf file under the
DocumentRoot "/library/webserver/documents" <directory "/library/webserver/documents" >
Change to the Sites path in your user directory is OK, as follows:
DocumentRoot "/users/username/sites" <directory "/users/username/sites" >
Once this is set up, the previous/library/webserver/documents cannot be accessed.
If you want to keep both, and even want to have a virtual hosting configuration, then the next article will be useful to you.
Configuring User-level Catalogs
1, in username (the agreement this article appears username for the user name) under the new folder called Sites (can only call this name, can not be other, pay attention to the case)
2. Open the/etc/apache2/httpd.conf file and remove the # number in front of the string below.
# Turn on user-level directory LoadModule userdir_module libexec/apache2/mod_userdir.so# turn on user-level directory configuration file include/private/etc/apache2/extra/ Httpd-userdir.conf
3. Open the/etc/apache2/extra/httpd-userdir.conf file and remove the #号 in front of the string below.
# Introduction of User Directory-level profile include/private/etc/apache2/users/*.conf
4, configure the user-level directory of the. conf, the address of the file is/etc/apache2/users/username.conf, if the file does not exist, then create one. Then open the Username.conf file and add the following configuration to the file:
<directory "/users/username/sites/" > Options Indexes multiviews allowoverride None Require All Granted</directory>
5, save all the changed files, and restart Apache, and then open 127.0.0.1/~username/in the browser, the link is opened by default in the user directory of the Sites directory inside the index file. If the following prompt appears, there is a problem with the username.conf configuration file.
Not foundthe requested the URL/~username/was not found on the this server.
Apache Configure user-level directory