Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Cloudflare subdomain help
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Cloudflare subdomain help

hostnoobhostnoob Member
edited September 2017 in Help

I have a server running lighttpd, with 3 sites on there. 2 with no sub domains, 1 with 2 subdomains.

i.e example1.com, example2.com, example3.com (sub1.example3.com, sub2.example3.com)

The sites all work, with PHP. However, when I access the subdomains I get 403 Forbidden.

Here is the layout

/var/sites/example1  
/var/sites/example2  
/var/sites/example3  
/var/sites/example3/sub1  
/var/sites/example3/sub2  

and here is the config file

$HTTP["host"] =~ "(^|\.)example1\.com$" {
    server.document-root = "/var/sites/example1"
}

$HTTP["host"] =~ "(^|\.)example2\.com$" {
    server.document-root = "/var/sites/example2"
}

$HTTP["host"] =~ "(^|\.)example3\.com$" {
    server.document-root = "/var/sites/example3"
}

$HTTP["host"] =~ "(^|\.)sub1\.example3\.com$" {
    server.document-root = "/var/sites/example3/sub1"
}

$HTTP["host"] =~ "(^|\.)sub2\.example3\.com$" {
    server.document-root = "/var/sites/example3/sub2"
}

the sub folders have index.php files in, and I'm sure this is related but not sure why it's happening and/or how to fix it.

Here is the config for PHP

# -*- depends: fastcgi -*-
# /usr/share/doc/lighttpd/fastcgi.txt.gz
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi

## Start an FastCGI server for php (needs the php5-cgi package)
fastcgi.server += ( ".php" =>
    ((
            "bin-path" => "/usr/bin/php-cgi",
            "socket" => "/var/run/lighttpd/php.socket",
            "max-procs" => 1,
            "bin-environment" => (
                    "PHP_FCGI_CHILDREN" => "4",
                    "PHP_FCGI_MAX_REQUESTS" => "10000"
            ),
            "bin-copy-environment" => (
                    "PATH", "SHELL", "USER"
            ),
            "broken-scriptfilename" => "enable"
    ))
)

Thanks

Edit: keep in mind PHP is working for everything else

Comments

  • What does the error_log show?

    Thanked by 1hostnoob
  • lighttpd error.log? nothing shows up in there

  • OK I got it working now. For some reason I had to set all of the folders to be owned by www-data

    Not sure why, since I've always created files as root and lighttpd has been able to read/execute them. Maybe just in the root webserver directory though?

    But at least it works

  • Check your umask.

Sign In or Register to comment.