1 Star 0 Fork 0

star / centos6_LANP_dockerfile

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Centos下构建LNMAP-web开发环境

环境说明: 宿主系统: Centos7

字母 代表 端口
L Centos6.9 \
N nginx 80 443
A apache2.2 8080
P php5.6 或者PHP7 5600 7000

系统安装

centos7安装 略

从github迁移到码云,地址跟换

https://raw.githubusercontent.com/funet8/centos6_LANP_dockerfile/master/shell/
改成:
https://gitee.com/funet8/centos6_LANP_dockerfile/raw/master/shell/

1.初始化系统

# wget https://gitee.com/funet8/centos6_LANP_dockerfile/raw/master/shell/CentOS7.x_system_init_shell_mini.sh

修改hostname和端口
# sh CentOS7.x_system_init_shell_mini.sh

2.新增挂载硬盘

# fdisk -l
# fdisk /dev/vdb
...
Command (m for help): n
Select (default p): p
Command (m for help): wq
格式化:
# mkfs.ext4 /dev/vdb1

# vi /etc/fstab 
添加:
/dev/vdb1 /home ext4 defaults 0 0 
# mount -a

新建服务器目录

# wget -q -O - https://gitee.com/funet8/centos6_LANP_dockerfile/raw/master/shell/create_dir.sh | bash -sh

新建Vs服务

# wget https://gitee.com/funet8/centos6_LANP_dockerfile/raw/master/shell/3-CentOS7.x_Vsftp.sh
修改参数
# sh 3-CentOS7.x_Vsftp.sh

安装docker

wget https://gitee.com/funet8/centos6_LANP_dockerfile/raw/master/shell/CentOS6_7_intall_docker.sh
sh CentOS6_7_intall_docker.sh

构建基于docker的openresty-WAF

wget https://gitee.com/funet8/centos6_LANP_dockerfile/raw/master/shell/run-aliyun-openresty.sh
需要修改是否连接PHPfpm-和数据库

sh run-aliyun-openresty.sh

#启动容器 --link链接mysql容器
********************************************
docker run -itd --name=openresty \
--restart always \
--link centos6_httpd_php56 \
-p 80:80 \
-p 443:443 \
-v /data/docker/openresty/nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf \
-v /data/docker/openresty/conf.d:/etc/nginx/conf.d \
-v /data/wwwroot/:/data/wwwroot/ \
-v /etc/localtime:/etc/localtime \
registry.cn-shenzhen.aliyuncs.com/funet8/openresty

构建基于docker的nginx

wget https://gitee.com/funet8/centos6_LANP_dockerfile/raw/master/shell/run-aliyun-nginx.sh
sh run-aliyun-nginx.sh

构建基于docker的apache2.2-php5.6

wget https://gitee.com/funet8/centos6_LANP_dockerfile/raw/master/shell/run-aliyun-apache.sh

sh run-aliyun-apache.sh

********************************************
docker run -itd --name centos6_httpd_php56 \
--restart always \
-p 8080:8080 \
-v /data/docker/httpd/httpd.conf:/etc/httpd/conf/httpd.conf \
-v /data/docker/httpd/php.ini:/etc/php.ini  \
-v /data/docker/httpd/conf.d/:/etc/httpd/conf.d/  \
-v /data/wwwroot/:/data/wwwroot/ \
registry.cn-shenzhen.aliyuncs.com/funet8/centos6.9-httpd-php:v5.7

构建基于docker的mysql

wget https://gitee.com/funet8/centos6_LANP_dockerfile/raw/master/shell/run-aliyun-mysql.sh
sh run-aliyun-mysql.sh

docker run -itd --name mysql \
--restart always \
-p 61950:3306 \
-v /data/docker/mysql_conf/my.cnf:/etc/my.cnf  \
-v /data/docker/mysql_conf/mysql_slowQuery.log:/var/log/mysql/mysql_slowQuery.log \
-v /data/docker/mysql_docker:/var/lib/mysql \
registry.cn-shenzhen.aliyuncs.com/funet8/centos6.9-mariadb:v1

宿主机安装php7.3

端口:7300
wget https://gitee.com/funet8/centos6_LANP_dockerfile/raw/master/centos7_intall_php7.3/CentOS7_Install_PHP7.3_PHPFPM.sh
sh CentOS7_Install_PHP7.3_PHPFPM.sh

切割日志

cd /data/conf/shell/
wget https://gitee.com/funet8/centos6_LANP_dockerfile/raw/master/shell/cut_log_nginx_docker.sh
chmod +x /data/conf/shell/cut_log_nginx_docker.sh
echo '00 00 * * * root /data/conf/shell/cut_log_nginx_docker.sh' >> /etc/crontab
systemctl restart crond

解决权限问题

###权限问题的总结
#在宿主上查看www用户的ID
cat /etc/passwd |grep www
www:x:1001:1001::/home/www:/sbin/nologin
#进入docker虚拟机
docker exec -it centos6_httpd_php56 /bin/bash
usermod -u 1001 www && groupmod -g 1001 www
#将所需要的目录更改权限
ll /data/wwwroot/web/

重启docker网络

这是由于来自守护进程的错误响应,而致使外部连接失败。解决的办法就是将其docker进程 kill掉,然后再 清空掉iptables下nat表下的所有链(规则) 。最后,将 docker的网桥删除,并重启docker服务

wget https://gitee.com/funet8/centos6_LANP_dockerfile/raw/master/shell/docker_net.sh
sh docker_net.sh
MIT License Copyright (c) 2022 star Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

各种docker-nginx-php-apache-mysql服务等 展开 收起
Shell 等 3 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Shell
1
https://gitee.com/funet8/centos6_LANP_dockerfile.git
git@gitee.com:funet8/centos6_LANP_dockerfile.git
funet8
centos6_LANP_dockerfile
centos6_LANP_dockerfile
master

搜索帮助