[nginx] unexpected "}" in /etc/nginx/sites-enabled/mastodon.save

Hi all,

I’m sure this is an easy fix as it’s just a syntax problem, but i’m unable to diagnose.

> Jun 08 06:42:07 chitownmastodon systemd[1]: Starting A high performance web server and a reverse proxy server...
> Jun 08 06:42:07 chitownmastodon nginx[2808]: nginx: [emerg] unexpected "}" in /etc/nginx/sites-enabled/mastodon.save:19
> Jun 08 06:42:07 chitownmastodon nginx[2808]: nginx: configuration file /etc/nginx/nginx.conf test failed
> Jun 08 06:42:07 chitownmastodon systemd[1]: nginx.service: Control process exited, code=exited status=1
> Jun 08 06:42:07 chitownmastodon systemd[1]: Failed to start A high performance web server and a reverse proxy server.
> Jun 08 06:42:07 chitownmastodon systemd[1]: nginx.service: Unit entered failed state.
> Jun 08 06:42:07 chitownmastodon systemd[1]: nginx.service: Failed with result 'exit-code'.

I don’t see a ‘}’ in my config in the https server block. This happened after i restarted my server for maintenance. I haven’t restarted it since upgrading to 1.4.1.

map $http_upgrade $connection_upgrade {
  default upgrade;
  ''      close;
}

server {
  listen 80;
  listen [::]:80;
  server_name chitownmastodon.tech;
  # Useful for Let's Encrypt
  location /.well-known/acme-challenge/ { allow all; }
  location / { return 301 https://$host$request_uri; }
}

server {
  listen 443 ssl http2;
  listen [::]:443 ssl http2;
  server_name chitownmastodon.tech;

  ssl_protocols TLSv1.2;
  ssl_ciphers HIGH:!MEDIUM:!LOW:!aNULL:!NULL:!SHA;
  ssl_prefer_server_ciphers on;
  ssl_session_cache shared:SSL:10m;

I took this straight from the production guide and just replaced the necessary values, as i thought i fat-fingered something in the config, but its still erroring out.

It can’t possibly end after ssl_session_cache, that’s not the full config at all

I was just pointing out that the error was at line 19, so i only showed the config a couple lines past that point.

I figured it out though. Somehow the mastodon config file was copied as ‘mastodon.save’ and this was the nginx config file that was serving my instance.

@danielolivas sites-enabled suggests you are using some operating system that manages web server configuration files for you to some extent and maybe mastodon.save got created after something was about to be overwritten after the reinstall/upgrade of nginx?

@saper Good point. That’s exactly what happened. Thanks for the tip.

1 Like