赞
踩
# 拉取 PHP+Nginx
docker pull webdevops/php-nginx
# 进入目录 cd ~/wang # 创建 mkdir app nginx # 配置文件 vim ~/wang/nginx/vhost.conf # 内容 server { listen 80 default_server; server_name _ *.vm docker; # 指定访问路径到TP6的public目录 root "/app/tp6/public"; index index.php; # 隐藏 index.php 以及使得Nginx支持pathinfo模式 if (!-e $request_filename) { rewrite ^/index.php(.*)$ /index.php?s=$1 last; rewrite ^(.*)$ /index.php?s=$1 last; } include /opt/docker/etc/nginx/vhost.common.d/*.conf; } ############## # SSL ############## server { listen 443 default_server; server_name _ *.vm docker; root "/app"; index index.php; include /opt/docker/etc/nginx/vhost.common.d/*.conf; include /opt/docker/etc/nginx/vhost.ssl.conf; }
# -v 目录映射
docker run --name nginx-php -p 8080:80 \
-v ~/wang/nginx/vhost.conf:/opt/docker/etc/nginx/vhost.conf \
-v ~/wang/app:/app \
-d webdevops/php-nginx
将TP6项目放置宿主机 ~/wang/app 下, 由于本机目录已做映射, 浏览器访问 IP:8080 直接进入TP6项目
同样支持pathinfo模式
也支持普通模式
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。