# Having trouble configuring lighttpd



## walterbyrd (Jun 24, 2015)

I have it installed, and it works for http, but I cannot seem to get the php5 module to work.

All the documentation I can find is old. It used to be that you just edited lighttpd.conf to enable modules. Now, apparently, you have to edit conf.d/fastcgi.conf.

I edited the php5 module in fastcgi.conf, just as I would have done in lighttpd.conf. But it is not working, and I have no idea why.

Any insight would be helpful.


----------



## junovitch@ (Jun 24, 2015)

If you configured everything in /usr/local/etc/lighttpd/conf.d/fastcgi.conf, did you also uncomment the FastCGI module in /usr/local/etc/lighttpd/modules.conf?  It seems all the modules there are commented by default.


----------



## walterbyrd (Jun 24, 2015)

No, I have not tried that. I am trying nginx now, and having the same problem. Maybe I'll go back to lighttpd. 

The lack of up-to-date documentation is very frustrating.


----------



## alphaniner (Jun 25, 2015)

If all else fails, look into the internals of NAS4Free (maybe FreeNAS too, all my experience is with N4F).


----------



## junovitch@ (Jun 25, 2015)

For www/nginx and lang/php56 (PHP-FPM is included by default):

Assuming you have this in your nginx.conf:

```
http {
    include                  /usr/local/etc/nginx/sites-enabled/*;
    # config continues...
```

/usr/local/etc/nginx/sites-available/my-vhost

```
server {
        listen       80;
        server_name  my-vhost.example.com my-vhost;

        access_log   /var/log/nginx/myvhost_access.log;
        root         /usr/local/www/example_php_site;

        location / {
            index index.php;
        }
        location ~ \.php$ {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME /usr/local/www/myvhost$fastcgi_script_name;
            include fastcgi_params;
        }
        location ~ /\.ht {
            deny all;
        }
    }
```

Then make it live.
`cd /usr/local/etc/nginx/sites-enabled && ln -s ../sites-available/my-vhost my-vhost`

If you need the PHP-FPM instance on a difference jail or machine than Nginx, just put the IP address of the PHP-FPM instance into the Nginx config above.  Don't forget to add the IP address of the Nginx machine into the PHP-FPM config.
/usr/local/etc/php-fpm.conf

```
listen.allowed_clients = 192.168.100.11,192.168.100.12
```

And of course:
`sysrc nginx_enable=YES; sysrc php_fpm_enable=YES; service nginx start; service php-fpm start`


----------



## junovitch@ (Jun 25, 2015)

walterbyrd said:


> No, I have not tried that. I am trying nginx now, and having the same problem. Maybe I'll go back to lighttpd.
> 
> The lack of up-to-date documentation is very frustrating.



Some notes on my configuration is above.  If getting PHP up and running is your goal and you aren't tied to a specific web server that should cover it for Nginx.  If you are tied to www/lighttpd then hopefully someone more familiar can jump in and assist.


----------

