LoginSignup
4
5

More than 5 years have passed since last update.

nginx: [emerg] unexpected "}"にカモられた話

Last updated at Posted at 2018-06-05
conf.d/myapp.conf
upstream myapp {
    server unix:/home/dragon_taro/run/myapp.sock fail_timeout=0;
}

server {
    listen 80;
    server_name 54.95.217.17;

    root /var/www/rails/myapp/public;

    try_files $uri/index.html $uri @myapp;

    location / {
        proxy_pass http://myapp; # アプリケーション名を記述
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
    }

    error_page 500 502 503 504 /500.html;
    client_max_body_size 4G;
    keepalive_timeout 10;
}

これでsudo nginx -tって実行すると、

nginx: [emerg] unexpected "}" in /etc/nginx/conf.d/myapp.conf:3

って出るんですよね。
{}は全部ついてるし、;も抜けてないしおかしいなと思ったら、

server unix:/home/dragon_taro/run/myapp.sock fail_timeout=0;◯

のあとにスペースが一つ入っていたんですよね。

そんなもん気づくかい!
ちゃんちゃん。

4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5