Mac的Apache和Ftp的配置

来源:互联网 发布:kmp算法中的next数组 编辑:程序博客网 时间:2024/05/16 00:32

启动Ftp服务器

开启和关闭的命令分别是以下两条,很简单

sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plistsudo -s launchctl unload -w /System/Library/LaunchDaemons/ftp.plist

想开机自启动ftp服务就编辑ftp.plist

<dict>    <key>Disabled</key>  --> 改为Enabled    <true/>

访问的用户名和密码是登录mac系统的用户名和密码。


配置Apache服务器

启动Apache

sudo apachectl start

在浏览器输入“http://localhost”,会显示“It works!”,说明服务器已经启动成功了。
Apache默认的根目录在“/Library/WebServer/Documents/”下。

找到apache藏身之所

系统默认是隐藏apache安装目录的,但我们可以通过“命令行”或者“文件夹前往”的方式找到它。它是安装在系统的私有目录下,也就是/private/etc下面,因为它是隐藏的,所以我们无法通过界面找到它。

open /etc

/ect 目录是mac os 系统存放系统配置信息的地方,里面都是xxx.conf的配置文件。

修改默认部署路径

跟windows不一样,它的部署包不是放在htdocs(windows下的存放目录),而是放在 “/资源库/WebServer/Documents/”下面。
找到下面httpd.conf文件,配置转发,模块启动停用之类操作都在该文件里面。
找到DocumentRoot,修改成你想要的地址即可。

重启apache

sudo apachectl -k restart

相关文章

  • Apache httpd服务器问题集合
    http://blog.csdn.net/lukaixiao/article/details/78005160