mirror of https://github.com/helloxz/dnmp.git
xiaoz
12 months ago
14 changed files with 91 additions and 260 deletions
@ -1,2 +1,4 @@
@@ -1,2 +1,4 @@
|
||||
# dnmp |
||||
Docker + nginx + MySQL + PHP |
||||
# DNMP |
||||
|
||||
Learn more about how DNMP can streamline your development process and make your projects more efficient. |
||||
|
||||
|
@ -1,2 +1,2 @@
@@ -1,2 +1,2 @@
|
||||
TZ=Asia/Shanghai |
||||
MYSQL_ROOT_PASSWORD=9N7DahRCqinY |
||||
MYSQL_ROOT_PASSWORD=root3306 |
@ -1,19 +0,0 @@
@@ -1,19 +0,0 @@
|
||||
FROM php:7.3-fpm-alpine3.12 |
||||
#设置时区,仅Debian需要 |
||||
#ENV TZ=Asia/Shanghai |
||||
#工作目录 |
||||
WORKDIR /root |
||||
#复制安装脚本 |
||||
COPY ./install.sh /root |
||||
#复制启动脚本 |
||||
COPY ./run.sh /usr/sbin |
||||
#执行安装脚本 |
||||
RUN sh install.sh |
||||
#暴露配置文件 |
||||
VOLUME /etc/nginx/conf.d |
||||
VOLUME /var/www/html |
||||
VOLUME /var/log/nginx |
||||
EXPOSE 80 |
||||
EXPOSE 443 |
||||
#运行crontab和nginx |
||||
CMD ["/usr/sbin/run.sh"] |
@ -1,53 +0,0 @@
@@ -1,53 +0,0 @@
|
||||
#!/bin/sh |
||||
#更新软件 |
||||
apk update |
||||
#安装timezone |
||||
apk add -U tzdata |
||||
#查看时区列表 |
||||
ls /usr/share/zoneinfo |
||||
#拷贝需要的时区文件到localtime |
||||
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime |
||||
#查看当前时间 |
||||
date |
||||
#为了精简镜像,可以将tzdata删除了 |
||||
apk del tzdata |
||||
#安装wget |
||||
apk add wget |
||||
chmod +x /usr/sbin/run.sh |
||||
|
||||
|
||||
#安装nginx |
||||
function install_nginx() { |
||||
#安装nginx |
||||
apk add nginx |
||||
mkdir -p /run/nginx/ |
||||
#wget -P /etc/nginx https://github.com/helloxz/dnmp/raw/main/php/nginx.conf |
||||
} |
||||
#设置PHP |
||||
function set_php(){ |
||||
#安装依赖 |
||||
apk add --no-cache autoconf gcc musl-dev g++ zlib-dev make libpng libpng-dev libjpeg-turbo-dev libwebp-dev zlib-dev libxpm-dev |
||||
#安装GD库 依赖 |
||||
#apk add libpng-dev |
||||
#设置php.ini |
||||
cp /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini |
||||
#zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so |
||||
#sed -i "s/www-data/www/g" /usr/local/etc/php-fpm.d/www.conf |
||||
#安装扩展 |
||||
docker-php-ext-install gd |
||||
pecl install redis-5.1.1 \ |
||||
&& pecl install xdebug-2.8.1 \ |
||||
&& docker-php-ext-enable redis xdebug |
||||
} |
||||
|
||||
#清理工作 |
||||
function run_clean(){ |
||||
apk del autoconf gcc musl-dev g++ zlib-dev make libpng libpng-dev libjpeg-turbo-dev libwebp-dev zlib-dev libxpm-dev |
||||
#清理编译 |
||||
rm -rf /var/cache/apk/* |
||||
} |
||||
install_nginx && set_php && run_clean |
||||
|
||||
echo '-----------------------------' |
||||
echo 'nginx + php install success.' |
||||
echo '-----------------------------' |
@ -1,158 +0,0 @@
@@ -1,158 +0,0 @@
|
||||
user www-data www-data; |
||||
worker_processes auto; |
||||
worker_rlimit_nofile 50000; |
||||
error_log logs/error.log; |
||||
#error_log logs/error.log notice; |
||||
#error_log logs/error.log info; |
||||
|
||||
pid /var/run/nginx.pid; |
||||
|
||||
|
||||
events { |
||||
use epoll; |
||||
worker_connections 51200; |
||||
#worker_connections 1024; |
||||
multi_accept on; |
||||
} |
||||
|
||||
|
||||
http { |
||||
include mime.types; |
||||
default_type application/octet-stream; |
||||
server_names_hash_bucket_size 128; |
||||
client_header_buffer_size 32k; |
||||
large_client_header_buffers 4 32k; |
||||
client_max_body_size 1024m; |
||||
client_body_buffer_size 10m; |
||||
sendfile on; |
||||
tcp_nopush on; |
||||
keepalive_timeout 120; |
||||
server_tokens off; |
||||
tcp_nodelay on; |
||||
proxy_headers_hash_max_size 51200; |
||||
proxy_headers_hash_bucket_size 6400; |
||||
#开启Brotli压缩 |
||||
brotli on; |
||||
brotli_comp_level 6; |
||||
#最小长度 |
||||
brotli_min_length 512; |
||||
brotli_types text/plain text/javascript text/css text/xml text/x-component application/javascript application/x-javascript application/xml application/json application/xhtml+xml application/rss+xml application/atom+xml application/x-font-ttf application/vnd.ms-fontobject image/svg+xml image/x-icon font/opentype; |
||||
brotli_static always; |
||||
|
||||
gzip on; |
||||
gzip_buffers 16 8k; |
||||
gzip_comp_level 6; |
||||
gzip_http_version 1.1; |
||||
gzip_min_length 256; |
||||
gzip_proxied any; |
||||
gzip_vary on; |
||||
gzip_types |
||||
text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml |
||||
text/javascript application/javascript application/x-javascript |
||||
text/x-json application/json application/x-web-app-manifest+json |
||||
text/css text/plain text/x-component |
||||
font/opentype application/x-font-ttf application/vnd.ms-fontobject |
||||
image/x-icon; |
||||
gzip_disable "MSIE [1-6]\.(?!.*SV1)"; |
||||
|
||||
#If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency. |
||||
open_file_cache max=1000 inactive=20s; |
||||
open_file_cache_valid 30s; |
||||
open_file_cache_min_uses 2; |
||||
open_file_cache_errors on; |
||||
|
||||
#limit connection |
||||
limit_conn_zone $binary_remote_addr zone=addr:10m; |
||||
|
||||
|
||||
server { |
||||
listen 80; |
||||
server_name localhost; |
||||
root /var/www/html; |
||||
index index.html index.htm index.php; |
||||
|
||||
#charset koi8-r; |
||||
|
||||
#access_log logs/host.access.log main; |
||||
|
||||
#location / { |
||||
# root /var/www/html; |
||||
# index index.html index.htm index.php; |
||||
#} |
||||
location ~ [^/]\.php(/|$) { |
||||
fastcgi_pass 127.0.0.1:9000; |
||||
fastcgi_index index.php; |
||||
include fastcgi.conf; |
||||
} |
||||
|
||||
#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 html; |
||||
} |
||||
|
||||
# proxy the PHP scripts to Apache listening on 127.0.0.1:80 |
||||
# |
||||
#location ~ \.php$ { |
||||
# proxy_pass http://127.0.0.1; |
||||
#} |
||||
|
||||
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 |
||||
# |
||||
#location ~ \.php$ { |
||||
# root html; |
||||
# fastcgi_pass 127.0.0.1:9000; |
||||
# fastcgi_index index.php; |
||||
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; |
||||
# include fastcgi_params; |
||||
#} |
||||
|
||||
# deny access to .htaccess files, if Apache's document root |
||||
# concurs with nginx's one |
||||
# |
||||
#location ~ /\.ht { |
||||
# deny all; |
||||
#} |
||||
} |
||||
|
||||
|
||||
# another virtual host using mix of IP-, name-, and port-based configuration |
||||
# |
||||
#server { |
||||
# listen 8000; |
||||
# listen somename:8080; |
||||
# server_name somename alias another.alias; |
||||
|
||||
# location / { |
||||
# root html; |
||||
# index index.html index.htm; |
||||
# } |
||||
#} |
||||
|
||||
|
||||
# HTTPS server |
||||
# |
||||
#server { |
||||
# listen 443 ssl; |
||||
# server_name localhost; |
||||
|
||||
# ssl_certificate cert.pem; |
||||
# ssl_certificate_key cert.key; |
||||
|
||||
# ssl_session_cache shared:SSL:1m; |
||||
# ssl_session_timeout 5m; |
||||
|
||||
# ssl_ciphers HIGH:!aNULL:!MD5; |
||||
# ssl_prefer_server_ciphers on; |
||||
|
||||
# location / { |
||||
# root html; |
||||
# index index.html index.htm; |
||||
# } |
||||
#} |
||||
include cdn/*.conf; |
||||
include vhost/*.conf; |
||||
} |
@ -1,6 +0,0 @@
@@ -1,6 +0,0 @@
|
||||
#!/bin/sh |
||||
#start nginx |
||||
/usr/sbin/nginx |
||||
echo 'start nginx success.' |
||||
#start php-fpm |
||||
/usr/local/sbin/php-fpm |
@ -0,0 +1,49 @@
@@ -0,0 +1,49 @@
|
||||
<!DOCTYPE html> |
||||
<html lang="en"> |
||||
<head> |
||||
<meta charset="UTF-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
<title>Welcome to DNMP</title> |
||||
<link href="https://libs.xiaoz.top/bootstrap/4.6.1/css/bootstrap.min.css" rel="stylesheet"> |
||||
<style> |
||||
body { |
||||
padding-top: 20px; |
||||
background-color: #f4f4f4; /* 轻微的灰色背景 */ |
||||
} |
||||
.jumbotron { |
||||
background-color: #fff; /* 亮色背景提高对比度 */ |
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 轻微的阴影效果 */ |
||||
} |
||||
.btn { |
||||
margin: 5px; /* 增加按钮间距 */ |
||||
} |
||||
@media (max-width: 768px) { |
||||
.btn { |
||||
width: 100%; /* 在较小的屏幕上按钮占满整行 */ |
||||
margin-bottom: 10px; |
||||
} |
||||
} |
||||
</style> |
||||
</head> |
||||
<body> |
||||
|
||||
<div class="container"> |
||||
<div class="jumbotron"> |
||||
<h1 class="display-4">Welcome to DNMP!</h1> |
||||
<p class="lead">DNMP is a powerful stack for web development, combining Docker, Nginx, MySQL, and PHP.</p> |
||||
<hr class="my-4"> |
||||
<p>Learn more about how DNMP can streamline your development process and make your projects more efficient.</p> |
||||
<div class="button-container"> |
||||
<a class="btn btn-primary" href="#" role="button" target = "_blank">Project address</a> |
||||
<a class="btn btn-secondary" href="#" role="button" target = "_blank">Help documentation</a> |
||||
<a class="btn btn-success" href="/phpMyAdmin/index.php" role="button" target = "_blank">Open phpMyAdmin</a> |
||||
<!-- More buttons can be added here in future --> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<!--<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script> |
||||
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.1.16/dist/umd/popper.min.js"></script> |
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>--> |
||||
</body> |
||||
</html> |
Binary file not shown.
Loading…
Reference in new issue