开启粘贴模式
:set paste
开启粘贴模式
:set paste
http://w.cn {
reverse_proxy 127.0.0.1:8100
}
http://hyperf.web {
reverse_proxy 127.0.0.1:9501
}
1、开放端口
firewall-cmd –zone=public –add-port=12345/tcp –permanent # 开放12345端口
firewall-cmd –zone=public –remove-port=12345/tcp –permanent #关闭12345端口
firewall-cmd –reload # 配置立即生效
2、查看防火墙所有开放的端口
firewall-cmd –zone=public –list-ports
3、关闭防火墙
systemctl stop firewalld.service
4、查看防火墙状态
firewall-cmd –state
5、查看监听的端口
yum install -y net-tools
netstat -lnpt
6、检查端口被哪个进程占用
netstat -lnpt |grep 12345
server
{
listen 80;
server_name xx.com;
index index.html index.php;
root /www/xx.com;
location /
{
index index.php;
if (!-e $request_filename) {
#多入口这几行也不需要
#rewrite /admin.php(.*)$ /admin.php$1 last;
#rewrite ^(.*)$ /index.php/$1;
#break;
rewrite ^/(.*)$ /index.php?s=$1 last;
}
}
location ~ [^/]\.php(/|$)
{
# comment try_files $uri =404; to enable pathinfo
#try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi5.6.sock;
fastcgi_index index.php;
include fastcgi.conf;
#注意pathinfo.conf不需要
#include pathinfo.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log off;
}
1.删除所有的容器 docker container rm -f `docker ps -a -q`
2.宿主机新建目录 mkdir -p /opt/vol/mysql /opt/vol/html
3.启动容器 docker container run -it –name=”old_centos” -v /opt/vol/mysql:/var/lib/mysql -v /opt/vol/html:/var/www/html centos:7
4.优化yum源 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl http://mirrors.aliyun.com/repo/Centos-7.repo -o /etc/yum.repos.d/CentOS-Base.repo
yum clean all && yum makecache
5.安装软件 yum install openssh-server httpd mysql mysql-server php php-mysql -y
6. 启动sshd
mkdir /var/run/sshd
echo ‘UseDNS no’ >> /etc/ssh/sshd_config
sed -i -e ‘/pam_loginuid.so/d’ /etc/pam.d/sshd
echo ‘root:123456’ | chpasswd
/usr/bin/ssh-keygen -A
补充:sshd镜像使用
docker commit 620dba4a45d2 centos_ssh
运行 docker run -d -p 2222:22 c7ssh /usr/sbin/sshd -D
7./etc/init.d/mysqld start
8.启动脚本 cd /opt/vol/html && vim init.sh
#!/bin/bash
/etc/init.d/mysqld start
/etc/init.d/httpd start
/usr/bin/sshd -D
其他的启动脚本
vim /init.sh
service nginx start
service nginx restart
service php-fpm7 start
service php-fpm7 restart
tail -f /etc/hosts
#最后一步是吼住不动了
提交容器
docker commit
启动容器
docker container run -d –name=”old_centos—_1″ -v /opt/vol/mysql:/var/lib/mysql -v /opt/vol/html:/var/www/html -p 2222:22 -p 8888:80 -p 33060:3306 容器名 /var/www/html/init.sh