Sinatra + unicorn の組み合わせで Webアプリを動かしていて、これに Nginx からプロキシを通したい。もうちょっと具体的に言うと、Sinatra アプリは 8080 番ポートで動いていて、外部からは 80 番ポートでアクセスできるように、Nginx を設定したい、ということ。
で、こんなふうな設定ファイルを書いたんだけど、設定ファイルのテストが通らない。
upstream unicorn-lcstorage {
# server unix:/var/run/unicorn/unicorn_lcstorage.sock;
server 127.0.0.1:8080;
}
server {
# port
listen 80;
# server name
server_name storage1.lathercraft.net;
# document root
root /home/lcstorage/lcstorage;
# index
#index index.php index.html index.htm;
# log files
access_log /var/log/nginx/storage1.lathercraft.net/access.log main;
error_log /var/log/nginx/storage1.lathercraft.net/error.log warn;
keepalive_timeout 600;
proxy_connect_timeout 600;
proxy_read_timeout 600;
proxy_send_timeout 600;
client_max_body_size 8G;
location / {
#root /home/lcstorage/lcstorage;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://unicorn-lcstorage;
}
}
takatoh@nightschool $ sudo /etc/init.d/nginx configtest * Testing nginx configuration [fail]
アプリ自体は 8080 番ポートで動いていることを確認済み。上の設定ファイルのリンクを /etc/nginx/sites-enabled から削除すると、テストが OK になるのも確認済み。なので、この設定ファイルが問題なのは間違いないと思うんだけど、一体どこが間違ってるのかわからない。
誰か、なにか気づいたら教えてください。