フリーランス 技術調査ブログ

フリーランス/エンジニア Ruby Python Nodejs Vuejs React Dockerなどの調査技術調査の備忘録

dockerでPHP環境を構築する

Dockerfile

FROM php:7.2-apache

docker-compose.yml

version: '3'
services:
  web:
    build: .
    volumes:
      - ./src/:/var/www/html/
    ports:
      - 80:80
      - 443:443

.htaccess

AuthUserFile /var/www/html/.htpasswd
AuthName "Please enter your ID and password"
AuthType Basic
require valid-user      

.htpasswod

basic認証のパスワードはこちら