I''m trying to host 2 URLs on the same webserver using lighttpd. One
ruby
site and one php site. I started a debian etch installation from
scratch, installed mysql, ruby, fastcgi, and lighttpd.
I got ruby working but the config file that it creates by default for
lighttpd didn''t do the trick.
Is it possible to do name based hosting in lighttpd? I''m trying to get
a
PHP site and a ruby app on the same machine like so:
http://example1.com/ --> php site
http://example1.com/phpmyadmin -> phpmyadmin
http://rubyexample.net/ -> ruby site
where example.com is in /var/www/example
and
where rubyexample.net is in /var/www/test
Here is my lighttpd config file.. ruby is working but I can''t get the
vhosts setup as above. Is it possible? Am I close?
PS: at this stage I''ve spent longer trying to figure out how to deploy
than actually writing the RoR app. :o)
# Default configuration file for the lighttpd web server
# Start using ./script/server lighttpd
server.port = 80
server.modules = ( "mod_rewrite", "mod_accesslog",
"mod_fastcgi", "mod_proxy", "mod_access",
"mod_fastcgi", "mod_compress",
"mod_simple_vhost" )
server.error-handler-404 = "/dispatch.fcgi"
server.document-root = "/var/www/"
server.errorlog = "log/lighttpd.error.log"
accesslog.filename = "log/lighttpd.access.log"
# Virtual Hosts I hope
$HTTP["host"] =~ "(www\.)?example\.com" {
server.document-root = "/var/www/test/public/"
}
url.rewrite = ( "^/$" => "index.html",
"^([^.]+)$" =>
"$1.html" )
# Change *-procs to 2 if you need to use Upload Progress or other tasks
that
# *need* to execute a second request while the first is still pending.
fastcgi.server = ( ".php" =>
( "localhost" =>
( "socket" => "/tmp/php-fastcgi.socket",
"bin-path" => "/usr/bin/php4-cgi",
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "16",
"PHP_FCGI_MAX_REQUESTS" => "10000"
),
# "bin-copy-environment" => (
#"PATH", "SHELL", "USER"
# ),
# "broken-scriptfilename" => "enable"
),
),
".fcgi" => (
"test" => (
"min-procs" => 1,
"max-procs" => 2,
"socket" => "log/fcgi.socket",
"bin-path" => "public/dispatch.fcgi",
"bin-environment" => ( "RAILS_ENV" =>
"development" )
)
)
)
mimetype.assign = (
".css" => "text/css",
".gif" => "image/gif",
".htm" => "text/html",
".html" => "text/html",
".jpeg" => "image/jpeg",
".jpg" => "image/jpeg",
".js" => "text/javascript",
".png" => "image/png",
".swf" => "application/x-shockwave-flash",
".txt" => "text/plain"
)
--
Posted via http://www.ruby-forum.com/.
Vince-
Here is a lighttpd.conf that will do exactly what you want it to do:
server.modules = (
"mod_rewrite",
"mod_redirect",
"mod_proxy",
"mod_access",
"mod_fastcgi",
"mod_compress",
"mod_accesslog" )
server.document-root = "/var/www"
server.bind = "0.0.0.0"
server.port = 80
server.pid-file = "/var/run/lighttpd.pid"
server.tag = "lighttpd"
accesslog.filename = "/var/log/lighttpd.access.log"
server.errorlog = "/var/log/lighttpd.error.log"
server.indexfiles = ( "index.php", "index.html",
"index.htm", "default.htm" )
url.access-deny = ( "~", ".inc" )
$HTTP["host"] =~ "(www\.)?example1\.com" {
accesslog.filename = "/var/log/lighttpd.php.access.log"
server.errorlog = "/var/log/lighttpd.php.error.log"
server.port = 80
server.document-root = "/var/www/"
server.indexfiles = ( "index.php", "index.html",
"index.htm", "default.htm"
)
# php-fastcgi config with it''s own php.ini.
# You must compile php with fast-cgi support
fastcgi.server = (
".php" =>
( "localhost" =>
(
"socket" =>
"/tmp/php4-fcgi.socket",
"bin-path" =>
"/usr/local/bin/php4-fcgi -
c /etc/php.ini",
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "32",
"PHP_FCGI_MAX_REQUESTS" =>
"5000"
)
)
)
)
}
# Rails site, I want this on www or no www
$HTTP["host"] =~ "(www\.)?rubyexample\.net" {
server.port = 80
server.document-root = "/var/www/test/public/"
server.error-handler-404 = "/dispatch.fcgi"
server.indexfiles = ( "index.php", "index.html",
"index.htm", "default.htm"
)
url.rewrite = ( "^/$" => "index.html",
"^([^.]+)$" => "$1.html" )
fastcgi.server = (
".fcgi" => (
"yhr_app1" => (
"socket" => "/tmp/lighttpd-fcgi1.socket",
"bin-environment" => ( "RAILS_ENV" =>
"development" ),
"bin-path" =>
"/var/www/test/public/dispatch.fcgi",
"max-load-per-proc" => 4,
"min-procs" => 1,
"max-procs" => 2,
"idle-timeout" => 60
)
)
)
}
mimetype.assign = (
".pdf" => "application/pdf",
".sig" => "application/pgp-signature",
".spl" => "application/futuresplash",
".class" => "application/octet-stream",
".ps" => "application/postscript",
".torrent" => "application/x-bittorrent",
".dvi" => "application/x-dvi",
".gz" => "application/x-gzip",
".pac" =>
"application/x-ns-proxy-autoconfig",
".swf" =>
"application/x-shockwave-flash",
".tar.gz" => "application/x-tgz",
".tgz" => "application/x-tgz",
".tar" => "application/x-tar",
".zip" => "application/zip",
".mp3" => "audio/mpeg",
".m3u" => "audio/x-mpegurl",
".wma" => "audio/x-ms-wma",
".wax" => "audio/x-ms-wax",
".ogg" => "audio/x-wav",
".wav" => "audio/x-wav",
".gif" => "image/gif",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".png" => "image/png",
".xbm" => "image/x-xbitmap",
".xpm" => "image/x-xpixmap",
".xwd" => "image/x-xwindowdump",
".css" => "text/css",
".html" => "text/html",
".htm" => "text/html",
".js" => "text/javascript",
".asc" => "text/plain",
".c" => "text/plain",
".conf" => "text/plain",
".text" => "text/plain",
".txt" => "text/plain",
".dtd" => "text/xml",
".xml" => "text/xml",
".mpeg" => "video/mpeg",
".mpg" => "video/mpeg",
".mov" => "video/quicktime",
".qt" => "video/quicktime",
".avi" => "video/x-msvideo",
".asf" => "video/x-ms-asf",
".asx" => "video/x-ms-asf",
".wmv" => "video/x-ms-wmv",
".bz2" => "application/x-bzip",
".tbz" =>
"application/x-bzip-compressed-tar",
".tar.bz2" =>
"application/x-bzip-compressed-tar"
)
Cheers-
-Ezra Zygmuntowicz
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org