当前位置: 首页 > news >正文

alpline 构建lnmp

alpline 构建lnmp

default.conf

map $http_upgrade $connection_upgrade {default upgrade;''      close;
}server {listen 80;root "/app/public";index index.php;charset utf-8;location / {try_files $uri $uri/ /index.php?$query_string;}location = /favicon.ico { access_log off; log_not_found off; }location = /robots.txt  { access_log off; log_not_found off; }access_log off;error_log  off;sendfile on;client_max_body_size 100m;location ~ \.php$ {fastcgi_split_path_info ^(.+\.php)(/.+)$;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;include fastcgi_params;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;fastcgi_intercept_errors off;fastcgi_buffer_size 16k;fastcgi_buffers 4 16k;fastcgi_connect_timeout 300;fastcgi_send_timeout 300;fastcgi_read_timeout 300;}location ~ /\.ht {deny all;}
}

Dockerfile

3.11 版alpine,默认对应的php版本是7.3.22

FROM alpine:3.11LABEL maintainer="gongxiaoliao@kailinjt.com"COPY Shanghai /etc/localtimeENV TIME_ZONE Asia/ShanghaiRUN echo "net.core.somaxconn = 65535" >> /etc/sysctl.conf && \echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf && \echo "Asia/Shanghai" > /etc/timezone# 添加用户 
RUN adduser www -H -D -s /sbin/nologin && \adduser redis -H -D -s /sbin/nologin# 安装nginx
RUN apk add nginx && \sed -i '/user/s#nginx#www#' /etc/nginx/nginx.conf && \mkdir -p /run/nginx && \chown -R www.www /run/nginxCOPY default.conf /etc/nginx/conf.d/# 安装php
RUN apk add php7 php7-fpm php7-pecl-apcu php7-bcmath php7-ctype php7-curl php7-dom php7-exif php7-fileinfo \php7-gd php7-iconv php7-pecl-igbinary php7-intl php7-json php7-pecl-mcrypt php7-mysqli php7-pcntl php7-pdo \php7-pdo_mysql php7-pdo_pgsql php7-phar php7-posix php7-pecl-redis php7-session php7-simplexml php7-tokenizer \php7-xml php7-xsl php7-opcache php7-zip php7-xmlwriter php7-xmlreader php7-zmq && \sed -i '/user/s#nobody#www#g' /etc/php7/php-fpm.d/www.conf && \sed -i '/group/s#nobody#www#g' /etc/php7/php-fpm.d/www.conf && \sed -i '/\;slowlog/s#\;##g' /etc/php7/php-fpm.d/www.conf# 添加代码
COPY app /app
RUN  chown -R www.www /appRUN  apk add redis
COPY redis.conf /etc/WORKDIR /app
EXPOSE 80# 安装守护进程
RUN apk add supervisorCOPY supervisor.conf /etc/supervisor/
COPY supervisor.nginx.conf /etc/supervisor/conf.d/
COPY supervisor.phpfpm.conf /etc/supervisor/conf.d/
COPY supervisor.redis.conf /etc/supervisor/conf.d/CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisor.conf"] 

supervisor

# supervisor.conf
[unix_http_server]          ; Web管理配置 
file=/run/supervisord.sock   ; socket文件路径[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB        ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10           ; (num of main logfile rotation backups;default 10)
loglevel=info                ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=true                ; (start in foreground if true;default false)
minfds=1024                  ; (min. avail startup file descriptors;default 1024)
minprocs=200                 ; (min. avail process descriptors;default 200)
user=root            ;; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface[supervisorctl]
serverurl=unix:///dev/shm/supervisor.sock ; use a unix:// URL  for a unix socket[include]
files = /etc/supervisor/conf.d/*.conf# supervisor.nginx.conf
[program:nginx]
command=nginx -g "daemon off;"
autostart=true
autorestart=true
priority=10
stdout_events_enabled=true
stderr_events_enabled=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
stopsignal=QUIT# supervisor.phpfpm.conf
[program:php-fpm]
command = php-fpm7 --force-stderr --nodaemonize
autostart=true
autorestart=true
priority=5
stdout_events_enabled=true
stderr_events_enabled=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
stopsignal=QUIT# supervisor.redis.conf
[program:redis]
command=redis-server /etc/redis.conf
autostart=true
autorestart=true
priority=10
stdout_events_enabled=true
stderr_events_enabled=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
stopsignal=QUIT
http://www.hskmm.com/?act=detail&tid=30905

相关文章:

  • 2025 年最新推荐操作台厂家排行榜:覆盖指挥中心 / 控制室 / 中控室 / 监控室 / 调度室场景,为用户选购优质产品提供专业参考
  • NVR设备ONVIF接入平台EasyCVR智慧小区视频监控系统建设方案
  • FPGA开发流程
  • 毕业论文技巧:Word中使用Mathtype对公式自动编号(带章节号)
  • 试验2
  • 浩辰CAD 2025 SP2安装包下载与安装教程
  • 高级程序语言设计第一次作业
  • Java word文档中的图片抽离方法
  • Kerberos认证(Elasticsearch)
  • 2025 年聚氨酯砂浆厂家最新推荐排行榜:聚焦欧洲技术与一站式服务的国内优质企业甄选指南水性聚氨酯砂浆/聚氨酯砂浆自流平厂家推荐
  • 在Anolis OS 8.10 GA上安装和配置VNC系统
  • 钩子(HOOK):改变系统行为的 “隐形抓手”
  • 浅谈InheritableThreadLocal---线程可继承的小书包
  • 2025 年涡街流量计厂家推荐,湖北南控仪表科技有限公司技术创新与行业应用解决方案解析
  • 2025 年超声波流量计厂家推荐,湖北南控仪表科技有限公司产品技术与行业应用解决方案解析
  • ArcGIS 10.2.2 字符串长度为20却仅能输入3个汉字的解决方法
  • 2025 年涡轮流量计厂家推荐:湖北南控仪表科技有限公司设备供应与多行业适配解决方案
  • OAuth/OpenID Connect安全测试全指南
  • 2025 年电磁流量计厂家推荐:湖北南控仪表科技有限公司专业设备供应与行业适配解决方案
  • 90%企业忽略的隐藏成本:Data Agent如何降低数据分析总拥有成本(TCO)
  • 123123123
  • adb logcat 根据Tag 过滤日志
  • 2025 年艺术涂料厂家最新推荐排行榜,全方位呈现优质品牌特色与竞争力
  • 爬虫遇到的问题与解
  • 自动化测试框架选型指南:数据驱动、关键字驱动还是混合模式?
  • 直播软件搭建避坑!从直播源码选型到运维,3步搞定上线+降本60%
  • LatchUtils:简化Java异步任务同步的利器
  • Qoder + ADB Supabase :5分钟GET超火AI手办生图APP
  • 深入解析:站内信设计分析
  • 实验报告2