Last Updated: February 25, 2016
·
724
· woss

Nginx VirtualHost with PHP_VALUE for XHGUI and fpm socket for Lumen

Simple Vhost sample for solving few things:

  • PHP_VALUE for xhgui per vhost
  • php-fpm socket usage
  • general Vhost for Lumen

Some posts were quite vague with position of PHP_VALUE, they just said location, not mentioning which one, it has to go to location where you set up PHP.

Hope this will help others too.

server {
        listen 80;
        server_name api.server.dev;

        root /your/root/public;
        index index.php;

        location / {
            try_files $uri $uri/ /index.php?$query_string;
            sendfile off;
        }

        error_page 404 /404.html;

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
            root /usr/share/nginx/html;
        }

        location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PHP_VALUE "auto_prepend_file=/app/xhgui/external/header.php";
            include fastcgi_params;
        }
    }