Search code examples
ubuntularavelnginxlaravel-forge

Laravel Forge server: invalid variable name in /etc/nginx/nginx.conf:63


After restarting my server (from the Forge control panel) I am no longer able to access my website. From the terminal, it looks like nginx isn't running. When I try and start nginx I'm getting the error:

invalid variable name in /etc/nginx/nginx.conf:63

This seems to refer to the last line of the http { ... } part of the conf file.

It's also showing

nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)

I'm not sure why it would suddenly do this after being restarted as it was working before.

I'm also not seeing a port 80 or 443 showing in my netstat -plnt

Any help appreciated


Solution

  • The problem wasn't actually with the /etc/nginx/nginx.conf file, but one of the files which was included from within the /etc/nginx/nginx.conf . Laravel Forge places environment variables in your site's nginx.conf (which you can access through the site config on Forge). By removing these variables from here I was able to start nginx again.