lighttpd for osx安装

在osx上安装 lighttpd是一个很有意思的过程。主要还是因为MacPorts不止是编译了lighttpd,还加上了一些好用的脚本。 :)
安装还是很简单的:

sudo port install lighttpd

安装好后,需要配置lighttpd.conf:

sudo cp /opt/local/etc/lighttpd/lighttpd.conf.default /opt/local/etc/lighttpd/lighttpd.conf


修改其中的一些配置,这个可以参考lighttpd自己的一些说明。一定会修改的是:server.document-root、server.errorlog、accesslog.filename。
配置好了,来试试lighttpd是不是可以启动:

sudo /opt/local/sbin/lighttpd -f /opt/local/etc/lighttpd/lighttpd.conf

接下来是MacPorts给我们带来的了,首先它准备好了一个适用于osx的启动说明文件/Library/LaunchDaemons/org.macports.lighttpd.plist,内容如下:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN
http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version='1.0'>
<dict>
<key>Label</key><string>org.macports.lighttpd</string>
<key>ProgramArguments</key>
<array>
        <string>/opt/local/bin/daemondo</string>
        <string>--label=lighttpd</string>
        <string>--start-cmd</string>
        <string>/opt/local/etc/LaunchDaemons/org.macports.lighttpd/lighttpd.wrapper</string>
        <string>start</string>
        <string>;</string>
        <string>--stop-cmd</string>
        <string>/opt/local/etc/LaunchDaemons/org.macports.lighttpd/lighttpd.wrapper</string>
        <string>stop</string>
        <string>;</string>
        <string>--restart-cmd</string>
        <string>/opt/local/etc/LaunchDaemons/org.macports.lighttpd/lighttpd.wrapper</string>
        <string>restart</string>
        <string>;</string>
        <string>--pid=none</string>
</array>
<key>Debug</key><false/>
<key>Disabled</key><false/>
<key>OnDemand</key><false/>
<key>RunAtLoad</key><false/>
</dict>
</plist>


这个xml文件还是比较容易看的。不过我们不用去修改它。我们可以通过一个简单的命令,来将它变为系统的启动Daemon:

sudo launchctl load -w /Library/LaunchDaemons/org.macports.lighttpd.plist

转载于:https://my.oschina.net/garro/blog/10597

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值