OS X apache配置,若碰到"The requested URL /~your userName/ was not found on this server."这里有详细解答

从网上随便搜一下,按步骤做到修改/etc/apache2/httpd.conf

在网上查了半天,我是漏了一句这个

#LoadModule userdir_module libexec/apache2/mod_userdir.so

这是我的,已经改好了

Last login: Thu Aug 11 19:31:58 on ttys003
hanxueyingdeMacBook-Pro:~ hanxueying$ sudo vi /etc/apache2/httpd.conf
hanxueyingdeMacBook-Pro:~ hanxueying$ sudo apachectl restart
hanxueyingdeMacBook-Pro:~ hanxueying$ sudo vi /etc/apache2.httpd.conf
Password:
hanxueyingdeMacBook-Pro:~ hanxueying$ sudo vi /etc/apache2/httpd.conf
hanxueyingdeMacBook-Pro:~ hanxueying$ sudo vi /etc/apache2/httpd-userdir.conf
hanxueyingdeMacBook-Pro:~ hanxueying$ sudo vi /etc/apache2/extra/httpd-userdir.conf
hanxueyingdeMacBook-Pro:~ hanxueying$ sudo apachectl restart
hanxueyingdeMacBook-Pro:~ hanxueying$ vi /etc/apache2/users/hanxueying.conf

[No write since last change]
/bin/bash: wq: command not found

shell returned 127

Press ENTER or type command to continue
[No write since last change]
/bin/bash: wq: command not found

shell returned 127

Press ENTER or type command to continue
[No write since last change]

Press ENTER or type command to continue
hanxueyingdeMacBook-Pro:~ hanxueying$ sudo vi /etc/apache2/users/hanxueying.conf
Password:
hanxueyingdeMacBook-Pro:~ hanxueying$ sudo apachectl restart
hanxueyingdeMacBook-Pro:~ hanxueying$ sudo vi /etc/apache2/users/hanxueying.conf
Password:
hanxueyingdeMacBook-Pro:~ hanxueying$ sudo vi /etc/apache2/users/hanxueying.conf
hanxueyingdeMacBook-Pro:~ hanxueying$ sudo vi /etc/apache2/httpd.conf

#
# 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, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/access_log"
# with ServerRoot set to "/usr/local/apache2" will be interpreted by the
# server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log"
# will be interpreted as '/logs/access_log'.

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
"/etc/apache2/httpd.conf" 531L, 20592C

 

还有在 /private/etc/apache2/users/Your UserName.conf中要写为

<Directory "/Users/YourUserName/Sites/">
  Options Indexes MultiViews
  AllowOverride None
  Require all granted
</Directory>

 

posted @ 2016-08-11 22:43  ShellHan  阅读(3928)  评论(0编辑  收藏  举报