9 months ago

Error with Homestead nginx custom config file

Posted 9 months ago by ChrisF79

Hi there,

I am trying to run a Wordpress site and Laravel together but I've installed wordpress properly on my development machine in a directory called I created a custom nginx config for the main listingnaples.test and it looks like this:

#!/usr/bin/env bash
declare -A params=     # Create an associative array
if [ -n "" ]; then
   for element in "${!params[@]}"
      fastcgi_param ${element} ${params[$element]};"

block="server {
        listen   80;
        server_name listingnaples.test;
        access_log off;
        error_log  /var/log/nginx/listingnaples.test-error.log error;

        location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

            fastcgi_intercept_errors off;
            fastcgi_buffer_size 16k;
            fastcgi_buffers 4 16k;
            fastcgi_connect_timeout 300;
            fastcgi_send_timeout 300;
            fastcgi_read_timeout 300;

        location ~* ^((?!\/blog)(.+)\.php)$  {
                include /etc/nginx/fastcgi_params;
               fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    location /blog/ {
        access_log off;
        proxy_pass http://blog.listingnaples.test;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

echo "$block" > "/etc/nginx/sites-available/"
ln -fs "/etc/nginx/sites-available/" "/etc/nginx/sites-enabled/"

The nginx error logs states:

2018/11/26 03:42:56 [emerg] 2991#2991: invalid number of arguments in "fastcgi_param" directive in /etc/nginx/sites-enabled/listingnaples.test:12

However, that will not load my site on my dev machine at listingnaples.test. It won't load anything in fact as if the site doesn't exist yet I can ping listingnaples.test on my machine.

The location /blog/ section is the redirect to the local blog portion.

Do you spot anything out of the ordinary that I have messed up here?


Please sign in or create an account to participate in this conversation.