LoginSignup
2
1

More than 3 years have passed since last update.

【Docker】ローカル環境でNginxが動く最小構成を作る

Posted at

PHP開発環境を作る上で、まずNginxが動く環境をローカルに構築してみます。

前提

  • Docker for Macがインストール済み

ファイル構成

以下の構成で2ファイル作成します。

├── docker-compose.yml
└── public
    └── index.html

各ファイルのソースはこのように設定します。

docker-compose.yml
version: '3'
services:
  nginx:
    image: nginx:latest
    ports:
      - 8080:80
    volumes:
       - ./public:/usr/share/nginx/html
index.html
<h1>Hello world!</h1>

Docker起動

$ docker-compose up

http://localhost:8080 にブラウザでアクセスすると無事にHello world!が表示されました。

参考

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