惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
爱范儿
爱范儿
T
The Exploit Database - CXSecurity.com
量子位
T
Tailwind CSS Blog
T
Threatpost
The GitHub Blog
The GitHub Blog
AWS News Blog
AWS News Blog
云风的 BLOG
云风的 BLOG
K
Kaspersky official blog
P
Proofpoint News Feed
博客园 - 司徒正美
L
LangChain Blog
T
Threat Research - Cisco Blogs
C
CERT Recently Published Vulnerability Notes
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 叶小钗
S
Secure Thoughts
The Last Watchdog
The Last Watchdog
Spread Privacy
Spread Privacy
H
Hacker News: Front Page
T
Troy Hunt's Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
W
WeLiveSecurity
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
P
Proofpoint News Feed
T
Tor Project blog
T
The Blog of Author Tim Ferriss
I
Intezer
P
Privacy & Cybersecurity Law Blog
美团技术团队
N
Netflix TechBlog - Medium
博客园_首页
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Vulnerabilities – Threatpost
Application and Cybersecurity Blog
Application and Cybersecurity Blog
G
Google Developers Blog
Attack and Defense Labs
Attack and Defense Labs
T
Tenable Blog
月光博客
月光博客
Stack Overflow Blog
Stack Overflow Blog
J
Java Code Geeks
腾讯CDC
Microsoft Security Blog
Microsoft Security Blog
A
About on SuperTechFans
Last Week in AI
Last Week in AI

维奥洛的航行日记

数据表字段设计 ERROR ERROR FOMO 何意味 恍惚间,自己分不清用的 win11 还是 arch 整理了一份佛经列表,闲时读下 与千问对话:AI 训练材料的广度 vscode、obsidian 等在 kde wayland 模式下 fcitx5 不能输入中文如何解决 arch linux install & config 这是我的九阳真经 像旅行者一样学习
podman nginx php dev-config
作者: vioulo · 2026-04-16 · via 维奥洛的航行日记

这篇文章距离最后更新已过38 天,如果文章内容或图片资源失效,请留言反馈,我会及时处理,谢谢!

创建 pod

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
sudo vim /etc/containers/registries.conf
[[registry]]
prefix = "docker.io"
location = "docker.m.daocloud.io" # 使用国内镜像加速

podman build -t php74-dev:latest -f Containerfile .
podman pull m.daocloud.io/docker.io/library/nginx:stable-alpine

sudo sysctl -w net.ipv4.ip_unprivileged_port_start=80
echo "net.ipv4.ip_unprivileged_port_start=80" | sudo tee /etc/sysctl.d/99-podman-ports.conf
sudo sysctl -p /etc/sysctl.d/99-podman-ports.conf

podman pod stop work-pod 2>/dev/null || true
podman pod rm -f work-pod 2>/dev/null || true

podman pod create --name work-pod -p 80:80

podman run -d --pod work-pod \
--name nginx \
-v /home/k-k/Documents/www:/var/www:Z \
-v /home/k-k/Documents/pod-conf/conf.d:/etc/nginx/conf.d:ro,Z \
nginx:stable-alpine

podman run -d --pod work-pod \
--name php74-dev \
-v /home/k-k/Documents/www:/var/www:Z \
localhost/php74-dev:latest php-fpm -F

composer install --ignore-platform-req=ext-grpc

chown -R www-data:www-data /var/www/work/erp_api/storage/logs /var/www/work/erp_api/bootstrap/cache
OR
chmod 777 -R erp_api/storage/ erp_api/bootstrap/ erp_api/public

# 查看隐藏容器
podman ps -a --external
podman unmount <CONTAINER ID>
podman rm <CONTAINER ID> <CONTAINER ID>
podman rmi <CONTAINER ID> <CONTAINER ID>

Containerfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# 使用 PHP 7.4 官方镜像
FROM php:7.4-fpm

# 配置清华大学镜像源
RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main non-free contrib" > /etc/apt/sources.list && \
echo "deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main non-free contrib" >> /etc/apt/sources.list && \
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main" >> /etc/apt/sources.list && \
echo "deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main" >> /etc/apt/sources.list \

# 配置国内 PECL 镜像
RUN echo "pecl.php.net = https://mirrors.aliyun.com/pecl" >> /usr/local/etc/php/conf.d/pecl.ini

# 安装依赖项
RUN apt-get update && apt-get install -y \
libpng-dev \
libjpeg62-turbo-dev \
libfreetype6-dev \
libzip-dev \
libmagickwand-dev \
libicu-dev \
libxml2-dev \
libssl-dev \
libbz2-dev \
git \
zlib1g-dev \
libonig-dev \
libc-client-dev \
libkrb5-dev \
&& rm -rf /var/lib/apt/lists/*

# 安装 PHP 扩展
RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
&& docker-php-ext-install imap

RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install \
bcmath \
gd \
pdo_mysql \
mysqli \
zip \
exif \
fileinfo \
mbstring \
intl \
soap \
sockets \
&& pecl install xlswriter imagick redis-5.3.7 \
&& docker-php-ext-enable xlswriter imagick redis

# 安装 Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

RUN echo "upload_max_filesize = 50M" >> /usr/local/etc/php/conf.d/custom.ini && \
echo "post_max_size = 50M" >> /usr/local/etc/php/conf.d/custom.ini && \
echo "memory_limit = 512M" >> /usr/local/etc/php/conf.d/custom.ini && \
echo "display_errors = On" >> /usr/local/etc/php/conf.d/custom.ini && \
echo "error_reporting = E_ALL" >> /usr/local/etc/php/conf.d/custom.ini && \
echo "date.timezone = Asia/Shanghai" >> /usr/local/etc/php/conf.d/custom.ini && \
# 优化 opcache(加速 PHP 执行)
echo "opcache.enable = 1" >> /usr/local/etc/php/conf.d/custom.ini && \
echo "opcache.validate_timestamps = 1" >> /usr/local/etc/php/conf.d/custom.ini && \
echo "opcache.revalidate_freq = 0" >> /usr/local/etc/php/conf.d/custom.ini # 开发环境实时刷新代码

# 设置工作目录
WORKDIR /var/www

# 暴露端口
EXPOSE 9000

# 启动命令
CMD ["php-fpm", "-F"]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
server {
listen 80;
server_name test-erp.com;

# 现在 root 和容器内路径完全一致
root /var/www/erp_api/public;
index index.php index.html index.htm;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

# 安全设置
location ~ /\. {
deny all;
}
}

版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自维奥洛的航行日记