How to modify lighttpd config file to allow for domain to connect to website rather than IP address

1.3k views Asked by At

So my issue is that I have a specific url defined in my lighttpd.conf file, but when typing that in my browser, it does not redirect me to my website. This is my lighttpd.conf file.

server.modules   += ( "mod_fastcgi" )
server.modules   += ( "mod_rewrite" )
fastcgi.debug = 1
debug.log-request-handling = "enable"
debug.log-file-not-found = "enable"
server.document-root = "/var/www/"


$SERVER["socket"] == ":8080" {
    server.username = "lighttpd"
    server.groupname = "supervisor"
    server.document-root = "/var/www/"
    server.port = 8080
    mimetype.assign = (
        ".html" => "text/html"
    )
    url.rewrite-once = (
    "^(/static($|/.*))$" => "$1",
    "^(/.*)$" => "/application.fcgi$1"
    )

    $HTTP["host"] =~ "^(www\.)?caseloader.com$" {
        server.document-root = "/var/www/"
        server.chroot = "/var/www/CaseLoader_Fl" 
        fastcgi.server = ( "application.fcgi" =>
         (( "socket" => "/tmp/fastcgi.socket",
            "bin-path" => "/home/knf/.virtualenvs/caseloader-webapp/bin/python/var/www/application.fcgi",
            "max-procs" => 1,
           "bin-environment" => (
             "REAL_SCRIPT_NAME" => ""
           ),
           "check-local" => "disable"
         ))
         )
    }

}

So to clarify, typing "caseloader.com" or "www.caseloader.com", with and without the port in the url, does not redirect me to my website.

Before, I had this line:

$HTTP["host"] =~ ":8080$" {

instead of

$HTTP["host"] =~ "^(www\.)?caseloader.com$" {

and that allowed me to connect to my website by typing in the IP address in my browser like this: http://x.x.x.x:8080.

The end goal is to allow for all the computers on my local network to access my website through a domain name instead of an IP address. I don't mind if they have to type in the port after the domain like "caseloader.com:8080", but I would rather have that than an IP address.

I'm not very familiar with the networking and I'm still new to using lighttpd, so please share any knowledge that you think is necessary for me to achieve my goal.

0

There are 0 answers