원본 : http://theexciter.com/articles/installing-lighttpd-on-osx
Lighttpd 1.3.11 has been released, which includes my patch for osx, I’ve updated this post to reflect this, since the patching step is no longer needed.
There’s been a lot of buzz in the Ruby on Rails community lately about lighttpd which claims to be a lightweight, secure and a friggin’ fast http server. And guess what? It most certainly is!
Below are my notes of getting lighttpd 1.3.10 up and running on Mac OSX 10.3with mod_mysql_vhost and mod_fastcgi. Please note that the patch andsymlinking of libmysql may or may not be needed in future versions oflighttpd. Also note that the MySQL version used below is based on the ServerLogistics Complete MySQL package, if you’re using a different package or your own the paths may be different, do a locate mysql_config
to figure out where it is.
First of all we need the FastCGI developer kit:
curl -O http://fastcgi.com/dist/fcgi-2.4.0.tar.gz
tar xzvf fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
./configure
make
sudo make install
We also need the pcre libraries:
(cd ..)
curl -O ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.4.tar.gz
tar xzvf pcre-5.0.tar.gz
cd pcre-5.0
./configure
make
sudo make install
Then, we need to download and unpack the lighttpd tarball:
(cd ..)
curl -O http://www.lighttpd.net/download/lighttpd-1.3.11.tar.gz
tar -xzvf lighttpd-1.3.11.tar.gz
cd lighttpd-1.3.11/
I wanted to be able to use the mod_mysql_vhost and since I’m using the ServerLogistics MySQL package, installed in /Library/MySQL/
a bit of manual tinkering was requirred. The easiest was to create a symlink for the header files to /usr/local/include/mysql
:
sudo ln -s /Library/MySQL/include/mysql /usr/local/include/mysql
Note: This probably isn’t really the optimalsolution, but I didn’t really feel like poking around too much in thesources to correct the path problem
Next we need to run the configure script, telling it we want to use mysql for the vhosts:
./configure --with-mysql=/Library/MySQL/bin/mysql_config
If all is good you should see something like this once the configure script is done:
Plugins:
mod_rewrite : enabled
mod_redirect : enabled
mod_ssi : enabled
mod_cgi : enabled
mod_fastcgi : enabled
mod_proxy : enabled
mod_evhost : enabled
mod_simple_vhost: enabled
mod_mysql_vhost : enabled
mod_access : enabled
mod_alias : enabled
mod_setenv : enabled
mod_usertrack : enabled
mod_compress : enabled
mod_auth : enabled
mod_status : enabled
mod_accesslog : enabled
mod_rrdtool : enabled
mod_secdownload : enabled
mod_expire : enabled
And finally we compile and install the binaries:
make
sudo make install
Hooray! We’ve successfully installed lighttpd, now we just need totake care of the config and log files and we’re good to go, start bycopying the lighttpd.conf to /etc (I think that’s a good place to haveit, you may disagree)
sudo cp doc/lighttpd.conf /etc/lighttpd.conf
Configuring the lighttpd.conf should be a breeze, it’s fairly self explanatory, also, please consult the documention
Now create and set the proper permissions on our two log files:
sudo touch /var/log/lighttpd.error.log
sudo chmod 666 /var/log/lighttpd.error.log
sudo touch /var/log/lighttpd.access.log
sudo chmod 666 /var/log/lighttpd.access.log
Finally, we can start the lighttpd webserver and start having some fun with it:
sudo lighttpd -f /etc/lighttpd.conf
You may wish to add the -D
flag so it’ll keep runningin the console, instead of as a daemon, to make it easier to shut downwhile you’re testing your config and such.
That’s it! You’re all set to go, using mysql based vhosts is fairly straingforward, just take a look at the documentation exampleto get an idea how to set it up. If one where to speculate freely onecould imagine that we set ourselves up a complete environment fordeveloping Rails projects, using Rails. Perhaps I’ll even write anarticle about that in the future, until then; enjoy your lighttpd!
- mongrel cluster proxy 사용을 위한 lighttpd.conf 설정
#server.modules = ("mod_rewrite", "mod_accesslog", "mod_fastcgi", "mod_compress", "mod_proxy")
server.modules = ("mod_accesslog", "mod_compress", "mod_proxy")
server.port = 80
server.username = "cndjr94"
server.groupname = "admin"
server.pid-file = "/WEB/config/pids/lighttpd.pid"
accesslog.filename = "/WEB/config/log/lighttpd/access_log"
server.errorlog = "/WEB/config/log/lighttpd/error_log"
server.indexfiles = ( "index.html" )
#url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html")
server.document-root = "/WEB/webapp/" + var.appname + "/public"
server.error-handler-404 = "/dispatch.fcgi"
proxy.balance = "fair"
proxy.server = ( "/" =>
( ( "host" => "127.0.0.1", "port" => 8001 ),
( "host" => "127.0.0.1", "port" => 8002 ),
( "host" => "127.0.0.1", "port" => 8003 ),
( "host" => "127.0.0.1", "port" => 8004 ) ) )
mimetype.assign = (
".css" => "text/css",
".gif" => "image/gif",
".html" => "text/html",
".jpeg" => "image/jpeg",
".jpg" => "image/jpeg",
".js" => "text/javascript",
".pdf" => "application/pdf",
".png" => "image/png",
".txt" => "text/plain",
)
'Linux' 카테고리의 다른 글
chown (0) | 2008.07.25 |
---|---|
linux java install (0) | 2008.06.04 |
설치 (0) | 2008.06.04 |
BIND,NAMED? DNS설정 (0) | 2008.06.04 |
Command2 (0) | 2008.06.04 |