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;
}

稀疏函数实现

package array;

public class sparseArray {
public static void main(String[] args) {
sparse();
}

public static void sparse() {
int length = 11;
int[][] array1 = new int[length][length];
array1[2][3] = 1;
array1[3][4] = 2;
System.out.println("原始数组");
prints(array1);

System.out.println("转为稀疏数组");
int sum = 0;//系数数组的个数
for (int i = 0; i < array1.length; i++) { for (int j = 0; j < array1.length; j++) { if (array1[i][j] != 0) { sum += 1; } } } int[][] array2 = new int[sum + 1][3]; array2[0][0] = length; array2[0][1] = length; array2[0][2] = sum; //赋值稀疏数组 int count = 0; for (int i = 0; i < array1.length; i++) { for (int j = 0; j < array1[i].length; j++) { if (array1[i][j] != 0) { count++; array2[count][0] = i; array2[count][1] = j; array2[count][2] = array1[i][j]; } } } prints(array2); System.out.println("还原稀疏数组"); int[][] array3 = new int[length][length]; for (int i = 1; i < array2.length; i++) { array3[array2[i][0]][array2[i][1]] = array2[i][2]; } prints(array3); } public static void prints(int[][] array) { for (int[] ints : array) { for (int anInt : ints) { System.out.print(anInt + "\t"); } System.out.println(); } } }

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