docker-compos安装php项目-可道云kodbox
从仓库下载
git clone https://github.com/kalcaddle/kodbox.git
git clone https://gitee.com/thinkyoung/kodbox.git
复制待对应目录
将内容复制到./data/kodbox/html
目录
修改配置文件docker-compose.yml
services:
php-kodbox:
image: php:7.4-apache
#image: php_app:latest
container_name: php-kodbox
environment:
# APACHE_DOCUMENT_ROOT=/var/www/html/public
# APACHE_STATIC_PORT_80: 8086 # 没有用
# 时区上海
TZ: Asia/Shanghai
ports:
- "8086:80"
volumes:
- ./data/kodbox/html:/var/www/html
# - ./data/kodbox/conf/ports.conf:/etc/apache2/ports.conf
# - ./data/kodbox/log:/var/log/apache2
#- ./data/kodbox/certs:/etc/apache2/ssl
# privileged: true
restart: no
networks:
my_net:
ipv4_address: 172.30.0.162
deploy:
resources:
limits:
#cpus: 0.25
memory: 512M
reservations:
#cpus: 0.2
memory: 256M
networks:
my_net:
driver: bridge
ipam:
config:
- subnet: 172.30.0.0/16
可以修改php启动端口
容器内的配置文件/etc/apache2/ports.conf
nginx代理返回静态文件中路径不带端口的问题
修改配置文件/etc/nginx/nginx.conf
将proxy_set_header Host $host;
改为proxy_set_header Host $host:$server_port;
server {
listen 8086;
server_name localhost;
#gzip off;
location / {
proxy_set_header Host $host:$server_port; # 这里加上$host:$server_port
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://10.***.***.46:8086/;
proxy_set_header X-Forwarded-Proto $scheme;
#sub_filter 'src="/' 'src="http://111.***.***.61:8086/';
#sub_filter_once off;
}
}
标签:set,compos,server,header,proxy,docker,kodbox,php
From: https://www.cnblogs.com/muphy/p/18563626