update to alpine
This commit is contained in:
parent
fd324b51b2
commit
ae768749f2
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
$link = mysqli_connect("172.18.0.2:3306", "root", "123456", "mysql");
|
||||
|
||||
if (!$link) {
|
||||
echo "Error: Unable to connect to MySQL." . PHP_EOL;
|
||||
echo "</br>";
|
||||
|
||||
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
|
||||
echo "</br>";
|
||||
|
||||
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);
|
||||
?>
|
|
@ -1,3 +0,0 @@
|
|||
<?php
|
||||
|
||||
phpinfo();
|
|
@ -0,0 +1,54 @@
|
|||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name localhost;
|
||||
|
||||
#charset koi8-r;
|
||||
#access_log /var/log/nginx/host.access.log main;
|
||||
|
||||
# location / {
|
||||
root /var/www/html;
|
||||
index index.html index.htm index.php;
|
||||
# }
|
||||
|
||||
#error_page 404 /404.html;
|
||||
|
||||
# redirect server error pages to the static page /50x.html
|
||||
#
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
||||
|
||||
# location ~ \.php$ {
|
||||
# # proxy_pass http://127.0.0.1;
|
||||
# proxy_pass php;
|
||||
# }
|
||||
|
||||
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
||||
|
||||
# location ~ \.php$ {
|
||||
# root html;
|
||||
# fastcgi_pass php:9000;
|
||||
# fastcgi_index index.php;
|
||||
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
|
||||
# include fastcgi_params;
|
||||
# }
|
||||
location ~ \.php$ {
|
||||
try_files $uri =404;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_pass php:9000;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
}
|
||||
# deny access to .htaccess files, if Apache's document root
|
||||
# concurs with nginx's one
|
||||
#
|
||||
#location ~ /\.ht {
|
||||
# deny all;
|
||||
#}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
FROM php:fpm-alpine
|
||||
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \
|
||||
apk add --no-cache --update \
|
||||
libxml2 libxml2-dev && \
|
||||
docker-php-ext-install mysqli soap && \
|
||||
docker-php-ext-enable mysqli soap
|
|
@ -1,5 +0,0 @@
|
|||
FROM php:7.3-fpm
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install iputils-ping \
|
||||
&& docker-php-ext-install mysqli && docker-php-ext-enable mysqli
|
Loading…
Reference in New Issue