#创建redis
docker create -p 6379:6379 -v redis:/data --restart=always --name myredis redis
#创建mysql
docker create --name mysql -p 3306:3306 -v mysql:/var/lib/mysql --restart=always -e MYSQL_ROOT_PASSWORD=Abc@123456 mysql:5.6 --character-set-server=utf8 --collation-server=utf8_general_ci
#创建nginx
server {
listen 80 default;
server_name huolicai.local;
access_log /var/log/nginx/huolicai_access.log;
error_log /var/log/nginx/huolicai_error.log;
location / {
root /data/shared/huolicai/public;
index index.php index.html;
if (-f $request_filename) {
break;
}
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php/$1 last;
break;
}
}
location ~ .+\.php($|/) {
root /data/shared/huolicai/public;
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
}
1,分别下载到/usr/local/src
http://nginx.org/download/nginx-1.12.2.tar.gz
https://ftp.pcre.org/pub/pcre/pcre-8.41.tar.gz
https://www.openssl.org/source/openssl-1.1.0g.tar.gz
http://www.zlib.net/zlib-1.2.11.tar.gz
2,
第一步:tar zxf 命令分别解压上面文件
第二步:cd nginx-1.12.2 执行 ./configure --prefix=/usr/local/nginx --with-pcre=/usr/local/src/pcre-8.41/ --with-openssl=/usr/local/src/openssl-1.1.0g/ --with-zlib=/usr/local/src/zlib-1.2.11/
第三步:make && make install
第四步:ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/ (添加环境变量,可以全局执行 nginx 命令)
第五步:(设置到系统命令+开机自动启动)
1, vim /lib/systemd/system/nginx.service (下面更改成对应的nging目录)
[Unit]
Description=nginx
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
2, 确保nginx关闭掉,然后: systemctl start nginx.service
3, 设置开机启动 systemctl enable nginx.service
4, 如果要把php也设置成系统命令 和开机启动
首先: /lib/systemd/system/php-fpm.service
其次:
[Unit]
Description=php-fpm
After=network.target
[Service]
Type=forking
ExecStart=/www/lnmp/php/sbin/php-fpm
PrivateTmp=true
[Install]
WantedBy=multi-user.target
然后:关闭php 执行 systemctl start php-fpm.service
最后:确保开机启动 systemctl enable php-fpm.service (参考https://www.jianshu.com/p/b5fa86d54685)
#创建rabbitmq
docker create --name rabbitmq -v rabbitmq:/var/lib/rabbitmq --restart=always -p 5672:5672 -p 15672:15672 -e RABBITMQ_DEFAULT_USER=monitor -e RABBITMQ_DEFAULT_PASS=Abc@123456 rabbitmq:3.7.3-management
#编译php7
1,yum install bison-devel readline-devel zlib-devel pcre-devel libedit-devel libxml2-devel gd ncurses-devel openssl-devel libcurl-devel libpng-devel libjpeg-turbo-devel libicu-devel libmcrypt-devel gd-devel
yum groupinstall "Development Tools"
2,wget http://hk2.php.net/get/php-7.1.15.tar.gz/from/this/mirror
3,mv mirror php7.tar.gz
4,tar xzf php7.tar.gz
5, groupadd php-fpm
useradd -r -g php-fpm -M
6,cd 到解压后的php-7.1.15文件夹 ,执行:
./configure --prefix=/usr/local/php7 --enable-fpm --with-zlib --enable-mbstring --with-openssl --with-mysqli --with-pdo-mysql --with-curl --enable-zip --enable-bcmath --enable-intl --with-xmlrpc --with-fpm-user=php-fpm --with-fpm-group=php-fpm
7,make && make install
8, mv /usr/local/src/php-7.1.5/php.ini-development /usr/local/php7/lib/php.ini
9, 编辑php.ini data.timezone=PRC
10. cp /usr/local/php7/etc/php-fpm.conf.default ./php-fpm.conf
10, cp /usr/local/src/php-7.1.15/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm #加入开机启动
11, chmod +x "/etc/init.d/php-fpm" 添加权限
12,ln -s /usr/local/php7/bin/php-config /usr/local/bin #加入环境变量
ln -s /usr/local/php7/bin/php-config /usr/local/bin
ln -s /usr/local/php7/bin/php-config /usr/local/bin
#安装git
1. yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
2,下载git (https://www.kernel.org/pub/software/scm/git/)
wget https://www.kernel.org/pub/software/scm/git/git-2.8.3.tar.gz
tar zxf 对应文件
cd 解压后的文件 ./configure prefix=/usr/local/git/
make && make install
查看git版本号 git --version
3, 生成key:
首先:cd ~/.ssh 然后ls看看有没有key
其次:ssh-keygen
然后:把pub的key加入到git仓库
然后:本地拉取 git clone 代码地址
#安装composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
ln -s /usr/local/src/composer.phar /usr/local/bin/composer (加到系统变量)
#补充
#查看卷的信息
docker volume inspect 容器名
#查看所有券
docker volume ls