Project

General

Profile

Named VHost on port 81

Added by superudu almost 14 years ago

Hello,

I have a Ubuntu 10.04 (lucid) x86_64 development server where Apache, PHP and MySql are installed.

I also want to use Lighttpd, but on port 81.

What I'm trying to do is to set a named based virtual host in lighttpd config on port 81.
I was able to create such name base vhost but on port 80. It seems that it needs something more if port 81 is being used.
I must also tell you that I am able to start the server on port 81 and if I place the server Document root to the same directory I planed to use in that vhost then it is able to display my webpage. (this works for only one page, but if I will add a second .. then I must find a solution to name based vhost on port 81)

Here are some details about what I installed and configured:

Installed:
- php5-cgi
and
- lighttpd (1.4.26)

Configured:
- in /etc/lighttpd/conf-enabled/ I have 10-fastcgi.conf and 10-simple-vhost.conf

this is what 10-fastcgi.conf contains

@server.modules += ( "mod_fastcgi" )

  1. Start an FastCGI server for php (needs the php5-cgi package)
    fastcgi.server = ( ".php" =>
    ((
    "bin-path" => "/usr/bin/php-cgi",
    "socket" => "/tmp/php.socket",
    "max-procs" => 2,
    "idle-timeout" => 20,
    "bin-environment" => (
    "PHP_FCGI_CHILDREN" => "4",
    "PHP_FCGI_MAX_REQUESTS" => "10000"
    ),
    "bin-copy-environment" => (
    "PATH", "SHELL", "USER"
    ),
    "broken-scriptfilename" => "enable"
    ))
    )
    @

and this is 10-simple-vhost.conf

@server.modules += ( "mod_simple_vhost" )

  1. The document root of a virtual host isdocument-root =
  2. simple-vhost.server-root + $HTTP["host"] + simple-vhost.document-root
    simple-vhost.server-root = "/var/www"
    simple-vhost.document-root = "/html/"
  1. the default host if no host is sent
    simple-vhost.default-host = "www.example.com"
    @

- in /etc/lighttpd/lighttpd.conf I have enabled the following besides the default:

@
...
server.modules = (
"mod_access",
"mod_alias",
"mod_accesslog",
"mod_fastcgi",
"mod_compress",
"mod_rewrite",
"mod_evhost",
...

$HTTP["host"] == "mysite.dev.mydomain.com:81" {
server.document-root = "/var/www/dev/mysite/htdocs"
server.errorlog = "/var/www/dev/mysite/logs/lgt_error.log"
accesslog.filename = "/var/www/dev/mysite/logs/lgt_access.log"
server.error-handler-404 = "/e404.php"
}
...

server.port = 81
...
@

It works now to see the page because I also added:
server.document-root = "/var/www/dev/mysite/htdocs"

I noticed that on port 80 name based vhost was working. So I suspect that something more must be added in that HTTP["host"] definition.

Can you please tell me what should I do to have a named base vhost on port 81 for mysite.dev.mydomain.com ?

Thank you.


Replies (1)

RE: Named VHost on port 81 - Added by superudu almost 14 years ago

please not that this forum replaces double hashes with numbers
first "1" is actually a double hash sign and first "2" is another double hash (those lines are actually commented out in my config file)

#

    (1-1/1)