#tradewind:add nginx

test
tradewind 4 years ago
parent 43d957f78b
commit 4d7a5e6f52
  1. 1
      .env
  2. 3
      .gitignore
  3. 17
      docker-compose.yml
  4. 18
      nginx/conf.d/example.conf
  5. 6
      nginx/dockerfile
  6. 9
      nginx/sources.list

@ -0,0 +1 @@
LOCAL_CODE_ROOT=/Users/tradewind/Projects

3
.gitignore vendored

@ -1,2 +1,3 @@
.idea
*.iml
*.iml
.env

@ -1,13 +1,28 @@
version: "3"
services:
nginx:
build:
context: ./nginx/
dockerfile: dockerfile
ports:
- 80:80
networks:
- server
volumes:
- ./nginx/conf.d:/etc/nginx/conf.d
- ./nginx/sources.list:/etc/apt/sources.list
- ${LOCAL_CODE_ROOT}:/var/www/http
- ./log/nginx:/var/log/nginx
container_name: nginx-server
restart: always
php7.4:
build:
context: ./php7.4/
dockerfile: dockerfile
volumes:
- ./php7.4/sources.list:/etc/apt/sources.list
- /var/www/http:/var/www/http
- ${LOCAL_CODE_ROOT}:/var/www/http
networks:
- server
container_name: php7.4

@ -0,0 +1,18 @@
server {
listen 80;
server_name example.com;
root /var/www/http/example;
location / {
index index.php index.html error/index.html;
autoindex off;
}
location ~ \.php(.*)$ {
fastcgi_pass php7.4:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}

@ -0,0 +1,6 @@
FROM nginx:alpine
MAINTAINER tradewind
RUN sed -i \
's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' \
/etc/apk/repositories && apk update
WORKDIR /var/www/http/

@ -0,0 +1,9 @@
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
Loading…
Cancel
Save