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 1 year has passed since last update.

Raspberry Pi で .Net の Web アプリケーションを Nginx で動かす

Last updated at Posted at 2019-12-30

次のバージョンで確認しました。

$ dotnet --version
6.0.302
$ nginx -v
nginx version: nginx/1.18.0

ポート 80 へのアクセスを、ポート 5000 へリバースプロキシします。

こちらで動かしたプロジェクトを Nginx で動かします。
Raspberry Pi で .Net Core の Web アプリケーションを publish

  1. Nginx のインストール
sudo apt install nginx-full
  1. ブラウザーで http://host にアクセスしてディフォールトの画面が表示されるのを確認。

/var/www/html/index.nginx-debian.html を改造して、表示が変わるのを確認。

  1. /etc/nginx/sites-available/default を編集
/etc/nginx/sites-available/default
#
server {
        listen 80 default_server;
        listen [::]:80 default_server;

        index index.html index.htm;

        server_name _;

        location / {
                proxy_pass http://127.0.0.1:5000;
                proxy_set_header X-Forwarded-Host $host;
        }
}

編集に問題がないことを確認。

sudo nginx -t
  1. Nginx を再起動
sudo systemctl restart nginx
  1. ブラウザーで http://host にアクセス
    nginx_kestrel.png
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?