What is the virtual host configuration for a ZF3 application with nginx?

Posted June 12, 2018 2.5k views
NginxUbuntu 18.04

What is the correct virtual host configuration for a Zend Framework 3 application on Ubuntu 18.04 with Nginx? Here mine:

server {
        listen 80;
        listen [::]:80;

        server_name dev.myapp.local;

        root /var/www/NetBeansProjects/myapp/public;
        index index.php index.html;

        location / {
                try_files $uri $uri/ @php;

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/run/php/php7.2-fpm.sock;

        location ~ /\.ht {
                deny all;

        location @php {
                fastcgi_pass unix:/run/php/php7.2-fpm.sock;
                fastcgi_param SCRIPT_FILENAME /var/www/NetBeansProjects/myapp/public/index.php;
                include fastcgi_params;
Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!