Mac OS X 配置Apache
2016-01-31 09:35
579 查看
Mac OS X上自带了Apache (安装目录为 /private/etc/apache2/ ),在Terminal里输入以下命令:
启动:apachectl start
停止:apachectl stop
关闭:apachectl restart
启动Apache之后,在浏览器地址栏输入localhost,出现『It Works』,表明Apache顺利启动。
『It Works』源自于 /Library/WebServer/Documents/index.html.en,为什么输入localhost就会显示这个文件呢?因为 apache/httpd.conf 里默认配置了 /Library/WebServer/Documents/ 为根目录。
注意:txsing是本人的用户名,以下出现的txsing都需要替换为自己的用户名。
在 /Users/txsing/ 目录下新建Sites文件夹
/Users/txsing/Sites/ 便是你的Apache用户根目录。
更新 /apache2/httpd.conf
删除以上4行行首的#号,默认情况下,前两句行首应该已经没有#号了。
更新 apache2/extra/httpd-userdir.conf
新建 apache2/users/txsing.conf 内容如下
启动:apachectl start
停止:apachectl stop
关闭:apachectl restart
启动Apache之后,在浏览器地址栏输入localhost,出现『It Works』,表明Apache顺利启动。
『It Works』源自于 /Library/WebServer/Documents/index.html.en,为什么输入localhost就会显示这个文件呢?因为 apache/httpd.conf 里默认配置了 /Library/WebServer/Documents/ 为根目录。
# DocumentRoot: The directory out of which you will serve your # documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. # DocumentRoot "/Library/WebServer/Documents" <Directory "/Library/WebServer/Documents"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.4/mod/core.html#options # for more information. # Options FollowSymLinks Multiviews MultiviewsMatch Any # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # AllowOverride FileInfo AuthConfig Limit # AllowOverride None # # Controls who can get stuff from this server. # Require all granted </Directory>
配置Apache用户目录
目标:浏览器地址栏输入 localhost\~txsing\,出现『hello world』。注意:txsing是本人的用户名,以下出现的txsing都需要替换为自己的用户名。
在 /Users/txsing/ 目录下新建Sites文件夹
/Users/txsing/Sites/ 便是你的Apache用户根目录。
更新 /apache2/httpd.conf
LoadModule authn_core_module libexec/apache2/mod_authn_core.so LoadModule authz_host_module libexec/apache2/mod_authz_host.so LoadModule userdir_module libexec/apache2/mod_userdir.so Include /private/etc/apache2/extra/httpd-userdir.conf
删除以上4行行首的#号,默认情况下,前两句行首应该已经没有#号了。
更新 apache2/extra/httpd-userdir.conf
Include/private/etc/apache2/users/*.conf
新建 apache2/users/txsing.conf 内容如下
<Directory"/Users/linuxidc/Sites/"> AllowOverride All Options IndexesMultiViews FollowSymLinks </Directory>
相关文章推荐
- 使用Apache commons-configuration读取配置文件
- php5.5+apache2.4
- Class org.apache.struts2.json.JSONWriter can not access a member of class
- linux---安装apache
- Root CA certificate:ApacheJMeterTemporaryRootCA.crt created in JMeter bin directory
- Apache DbUtils 教程
- Apache Prefork、Worker和Event三种MPM分析
- Apache Kafka
- Apache htaccess 重写假设文件存在!
- Apache Kylin 部署之不完全指南
- SparkStreaming运行出现 java.lang.NoClassDefFoundError: org/apache/htrace/Trace 错误
- apache commons io 提案
- 重启Apache报错apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName ... waiting的解决方法
- Ubuntu下开启Apache重写扩展
- Apache OFBiz技术架构
- apache kafka监控系列-KafkaOffsetMonitor
- apache的开源工具common-fileupload实现文件上传和下载
- Apache Rewrite规则详解
- apache commons io 未来任务与展望
- Apache Spark Jobs 性能调优(二)