0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

dump1090-faのサーバーをNginxにする

Posted at

dump1090-faをインストールすると、自動的にlighttpdが導入されます。
lighttpdは軽量で良いのですが、僕はNginxが大好きなので切り替えたいと思います。

環境

当然のことながらdump1090-faなど、ADS-Bを受信する環境が整っているものとします。
私はFlightAwareFlightradar24に記載の公式ガイドに則ってインストールしました。

Linux raspberrypi 5.10.17-v7+ #1403 SMP Mon Feb 22 11:29:51 GMT 2021 armv7l GNU/Linux

lighttpdに別れを告げる

「ごめん、君のことは友達以上に思えない」

sudo systemctl stop lighttpd && sudo systemctl disable lighttpd

停止のみでアンインストールはしないでおきます。

先に停止しないと、Nginxをインストールするときにポートで競合してエラーになります。
二股はよくないですもんね。

Nginxにアタックする

「あ、あの…、ずっと君のことが…!」

sudo apt install nginx

特に何もなくサクッと入ると思います。

設定

諸々お好みの設定にしてください。

dump1090-fa関連の設定だけピックアップします。
下記ファイルを、アクセスを待ち受けるserverディレクティブ内にインクルードすれば動きます。

skyaware.conf
location ^~ /skyaware/ {
    alias /usr/share/skyaware/html/;
}
location ^~ /skyaware/data/ {
    alias /run/dump1090-fa/;
}

簡易的にですが雛形も記しておきます。

sites-enabled/default.conf
server {
        listen [::]:80;
        listen [::]:443 ssl http2;

        root /var/www/example.com;

        index index.php index.html;

        server_name example.com;

        # Location settings
        location / {
                try_files $uri $uri/ =404;
        }

        include conf.d/skyaware;  # Standby for SkyAware

        # SSL configuration
        ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
        ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
}

おわりに

http2に対応できたり、CSPを設定できたりとNginxの方がモダンに色々できてよいですね。
Certbotも標準で対応しているので更新の手間も少ないです。

手軽に移行できるので皆さんもぜひ試してみてください。

0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?