LoginSignup
1
1

More than 1 year has passed since last update.

【サーバ構築】nginxでwebサーバを起動

Posted at

はじめに

dockerを使ってnginxのコンテナを立ち上げてみました。

docker-compose.yml

docker-compose.yml
version: "3"
services:
 ngweb1:
  image: nginx:1.21.6
  ports:
   - 80:80
  volumes:
   - ./nginx/html:/usr/share/nginx/html

あとは、docker-compose.ymlのディレクトリでdocker-compose up -dです。

image:nginxのバージョンを指定しています。
ngweb1:サービス名です。コンテナ間の通信をする場合は、html://ngweb1でいけます。
volumes:OS側とコンテナ側でフォルダを共有することができます。(左:OS側、右:コンテナ側)
port:サービスに使用するport番号を指定しています。(左:OS側、右:コンテナ側)

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