Thursday, April 12, 2018

Re: httpd - serving index.html & index.php at the same time

On Tue, Apr 10, 2018 at 3:24 PM, Mischa <obsdml@high5.nl> wrote:
> Is there a way to serve both static and dynamic content, eg. index.html and index.php within the same server { } definition?
> I am looking for something like:
>
> server "default" {
> listen on $ext_addr port 80
> root "/htdocs"
> directory index "index.html" # not needed as it's the default
> location "/files/*" {
> root "/htdocs/files"
> directory auto index
> }
> location "^/phpapp/*" {
> root "/htdocs/phpapp"
> directory index "index.php"
> fastcgi socket "/run/php-fpm.sock"
> }
> }

This is what I have and it works fine:

server aaaa.bbbb.net {
listen on * port 80
listen on * tls port 443
tls {
key "/path/to/my/key"
certificate "/path/to/my/cert"
}
root "/ftp"
directory auto index
location "*.php" {
fastcgi socket "/run/php-fpm.sock"
}
}

Using this I can serve index.php and index.html from the same
directory (no need to segregate php into its own subdirectory).

-ken

No comments:

Post a Comment