# nginx simple php config



## abdelilah (Nov 3, 2013)

Hi everyone,

Could it be possible to nginx without all the plethora of cgi/fascgi/fpm-php, basically all I'm trying to do is hosting a simple PHP site (adminer/phpmyadmin...) into my new nginx install, the problem is that I'm facing mumbling terms like fascgi among others.

I've installed nginx and php55+ extension but I still can't use my server.

Could someone please help.

Update: I'll stick with lighttpd as I have always done, I don't really need all this trouble to make a simple site working. Nginx may be excellent but is a pain to configure and understand in the first place, so to all who read my post thank you.


----------



## junovitch@ (Nov 5, 2013)

If you change your mind, it's not overly difficult to setup.  Basically, just install lang/php5 with the FPM option enabled, set php_fpm_enable="YES" in your /etc/rc.conf and start it.

Then in your nginx.conf you'll have something along this lines.  This is actually the exact code I have in use for my media server.  In this case, Serviio has PHP-FPM in a different jail and the nginx jail maps to it by IP.  You can also map to a socket on the host.  Basically the effect is nginx passes the filename to the PHP process, PHP-FPM handles it and returns the site to nginx to give to the client.


```
server {
        listen 80;
        server_name serviio-console;
        root /usr/local/www/Web-UI-for-Serviio-Serviio-1.3;
        location / {
            index index.php;
        }
        location ~ \.php$ {
            fastcgi_pass 10.100.102.17:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME /usr/local/www/Web-UI-for-Serviio-Serviio-1.3$fastcgi_script_name;
            include fastcgi_params;
        }
        location ~ /\.ht {
            deny all;
        }
    }
```


----------

