0
0

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.

ラズベリーパイで小型Webサーバーをつくってみる。

Last updated at Posted at 2022-02-26

nginxを導入

まずは恒例のupdateとupgrade

sudo apt update
sudo apt upgrade

その後にnginxをインストール。

sudo apt install nginx

インストールが完了したら以下のコマンドを実行して、nginxを起動。
また、再起動したときnginxが自動で起動するようにします。

sudo systemctl start nginx
sudo systemctl enable nginx

ラズベリーパイと同一のネットワーク内にあるPCでブラウザを起動。
そして、http://ラズベリーパイのIPアドレスと入力してEnterを押すと、「Welcom to nginx」と書かれたページが表示されます。
スクリーンショット 2022-02-26 19.40.56.png

nginxではデフォルトで「var/www/html/」がドメインルートになっている。
この中にindex.htmlファイルを作成して編集。

sudo mousepad /var/www/html/index.html

適当にコーディングして表示してみる。
スクリーンショット 2022-02-26 20.08.37.png

先程の「Welcom to nginx」と書かれたブラウザをリロードすると表示されました!

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?