diff --git a/conf.d/nginx.conf b/conf.d/nginx.conf deleted file mode 100644 index 8731d5b..0000000 --- a/conf.d/nginx.conf +++ /dev/null @@ -1,18 +0,0 @@ -server { - listen 80; - server_name localhost; - location / { - root /var/www/html; - index index.html index.htm index.php; - } - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /var/www/html; - } - location ~ \.php$ { - fastcgi_pass php:9000; - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME /var/www/html/$fastcgi_script_name; - include fastcgi_params; - } -} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index fb5e490..eceb41a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,50 +1,52 @@ version: '2' services: nginx: - image: nginx:latest + image: nginx:alpine + restart: always # 端口映射 ports: - "80:80" # 依赖关系 先跑php - depends_on: - - "php" + # depends_on: + # - "php" # 数据卷 volumes: # 映射主机./conf.d目录到容器/etc/nginx/conf.d目录 - - "$PWD/conf.d:/etc/nginx/conf.d" - - "/sharedfolders/web/site80/html:/usr/share/nginx/html" + - "$PWD/nginx/conf.d:/etc/nginx/conf.d" + - "/sharedfolders/hd2/web/80:/var/www/html" networks: - - app_net + - web_net # 容器名称 - container_name: "compose-nginx" + container_name: "web_nginx" php: - build: ./php-mysqli - image: php:7.3-fpm-mysqli - ports: - - "9000:9000" + build: ./php-mysql + # image: php:fpm-alpine + restart: always + # ports: + # - "9000:9000" volumes: - - "/sharedfolders/web/site80/html:/var/www/html" + - "/sharedfolders/hd2/web/80:/var/www/html" networks: - - app_net - container_name: "compose-php" - mysql: - image: mysql:5.7 - ports: - - "3306:3306" - # 环境变量 - environment: - # mysql密码 - - MYSQL_ROOT_PASSWORD=lldlcj123 - networks: - app_net: - # 固定子网ip,网段必须在子网络192.168.8.* - ipv4_address: 192.168.8.6 - container_name: "compose-mysql" + - web_net + container_name: "php-fpm" + # mysql: + # image: mysql:5.7 + # ports: + # - "3306:3306" + # # 环境变量 + # environment: + # # mysql密码 + # - MYSQL_ROOT_PASSWORD=lldlcj123 + # networks: + # web_net: + # # 固定子网ip,网段必须在子网络192.168.8.* + # ipv4_address: 192.168.8.6 + # container_name: "compose-mysql" networks: # 配置docker network - app_net: + web_net: driver: bridge - ipam: - config: - # 子网络 - - subnet: 192.168.8.0/24 + # ipam: + # config: + # # 子网络 + # - subnet: 192.168.8.0/24 diff --git a/html/connect_mysql.php b/html/connect_mysql.php deleted file mode 100644 index 1ab78e5..0000000 --- a/html/connect_mysql.php +++ /dev/null @@ -1,19 +0,0 @@ -"; - - echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL; - echo "
"; - - echo "Debugging error: " . mysqli_connect_error() . PHP_EOL; - exit; -} - -echo "Success: A proper connection to MySQL was made! The my_db database is great." . PHP_EOL. "\n"; -echo "Host information: " . mysqli_get_host_info($link) . PHP_EOL. "\n"; - -mysqli_close($link); -?> \ No newline at end of file diff --git a/html/index.php b/html/index.php deleted file mode 100644 index f35a8ef..0000000 --- a/html/index.php +++ /dev/null @@ -1,3 +0,0 @@ -