LoginSignup
6
3

More than 5 years have passed since last update.

GitHubを自らのNanoPIに!

Last updated at Posted at 2018-06-28

はじめに

NanoPIの出現によって今まで考えもしなかったServerの用途が広がりました。Noteパソコンの1/10の価格で持ち歩けるサーバーが手に入るのです。私はこれまでNanpPIを様々な用途に活用する発表を行ってきました。多くは今までServerとしての用途です。今回はすっかり有名になった末MSに買収されたGithubの機能を凝集してNanoPIに収める方法について発表いたします。

用意するもの

  • NanoPI (できればNanoPI + Nas Kit)
  • Nginxが走る環境 (なにapt install nginxだけです)
  • gitが走る環境(基本的にapt install git)

fcgiwrapの準備

nginxでperl, phpをCGIとして走らせるにはちょっとだけ準備が必要です。ここでは必要なperlについてだけ説明します。もう準備済みの方は飛ばしてください。
方法は複数ですが私はfastwrapを使います。ほかの方法が好みの方はご随意にどうぞ。

apt install fcgiwrap

続いて*.plに対してfastwrapが有効になるようにします。これもやり方は色々です。私はあまり細かいことをFileに分けるのは見通しが悪く感じるので、できるだけ1つのファイルで済ませるようにしているのです。分かる方で主義主張の異なる方は弄っていただいて結構です。

vi /etc/nginx/sites-available/default
...
# Default server configuration
#
server {
        listen 80 default_server;
        listen [::]:80 default_server;

        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;

        root /home/www/html;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;

        # server_name *;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }
        location ~ \.pl$ {
            root /home/www/html;
            fastcgi_pass unix:/var/run/fcgiwrap.socket;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
        }
...

皆様の知恵の集約であるアーカイブを持って行って展開する。

cd /path/to/Http_Root
wget http://line.to/mac/soft/gitweb.tgz
tar xf gitweb.tgz

変更を反映させて、結果を確認する。

/etc/init.d/fcgiwrap restart
/etc/init.d/nginx restart

ブラウザで http://nanopi/gitweb/gitweb.pl

謝辞

  • Gitwebを作成したKay Sievers kay.sievers@vrfy.org, Christian Gierkeに感謝します。このソフトがなければ何も始まらなかったでしょう。
  • 田中 秀宗さんに感謝します。NanoPIへのDeployは彼の業績です。
  • FB「NanoPIの部屋」のメンバーに感謝します。ここでの公開を勇気づけてくれるのは彼らの存在です。
6
3
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
6
3