阿里云


原文链接: 阿里云

iguocai

初始化

docker run --rm -it --name mysql_iguocai -p 3306:3306 -v $HOME/docker/linyibr/iguocai/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=iguocai2017 -e MYSQL_DATABASE=iguocai -e MYSQL_USER=iguocai -e MYSQL_PASSWORD=iguocai2017 mysql

docker run --rm --name phpmyadmin -p 222:80 --link mysql_iguocai:db phpmyadmin/phpmyadmin

docker run -it --rm --name php_iguocai -p 80:80 --link mysql_iguocai:mysql -v /root/docker/linyibr/iguocai/master:/var/www/html trafex/alpine-nginx-php7

docker run -it --rm --name nginx_iguocai -p 80:80 --link php_iguocai:php_fpm nginx

rsync -avzH /home/ubuntu/docker/linyibr/iguocai/master/ root@demo.linyibr.com:/root/docker/linyibr/iguocai/master

liuzhishan

docker run --rm -it --name yishui_mysql -p 3306:3306 -v $HOME/docker/yishui/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=toor -e MYSQL_DATABASE=yishui mysql
docker run --rm --name phpmyadmin -p 8080:80 --link yishui_mysql:db phpmyadmin/phpmyadmin

docker run -ti --rm --name yishui_apache --link yishui_mysql:mysql -p 80:80 -v $HOME/docker/yishui/onethink:/var/www/html rinetd/php:apache

#yimengapp.com
docker run -d --restart=always --name yimeng_mysql -p 3306:3306 -v /var/www/yimeng/mysql:/var/lib/mysql mysql:5.6
docker run -td --restart=always --name yimeng_apache --link yimeng_mysql:mysql -p 80:80 -v /var/www/yimeng/Uploads/:/var/www/html/Uploads/ -v /var/www/yimeng/www-data:/var/www/html rinetd/php:apache

wuye

  1. git clone git@git.oschina.net:keyixinxi/wuye.git ~/docker/wuye/master
  2. 启动 mysql docker run -d --restart=always --name wuye_mysql -p 3306:3306 -v ~/docker/wuye/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=toor -e MYSQL_DATABASE=sanyang mysql:5.6
  3. 导入数据 docker exec -i wuye_mysql mysql -uroot -ptoor sanyang <sanyang2016-4-28.sql
  4. docker run --rm --name phpmyadmin -p 8080:80 --link wuye_mysql:db phpmyadmin/phpmyadmin
  5. 启动 php docker run -td --restart=always --name wuye_apache --link wuye_mysql:mysql -p 80:80 -v ~/docker/wuye/Uploads/:/var/www/html/Uploads/ -v ~/docker/wuye/master:/var/www/html rinetd/php:apache
    vi wuye/Conf/db.php

    nginx指定端口9011

    docker run -d --restart=always --name yimeng_mysql -p 3306:3306 -v /var/www/yimeng/mysql:/var/lib/mysql mysql:5.6
    docker run -td --restart=always --name yimeng_apache9011 --link yimeng_mysql:mysql -p 9011:80 -v /var/www/yimeng/Uploads/:/var/www/html/Uploads/ -v /var/www/yimeng/www-data:/var/www/html rinetd/php:apache

    master 9011

    docker run -td --restart=always --name yimeng_apache_master --link yimeng_mysql:mysql -p 9011:80 -v /var/www/yimeng/Uploads/:/var/www/html/Uploads/ -v /var/www/yimeng/master:/var/www/html rinetd/php:apache

release 9012

docker run -td --restart=always --name yimeng_apache_release --link yimeng_mysql:mysql -p 9012:80 -v /var/www/yimeng/Uploads/:/var/www/html/Uploads/ -v /var/www/yimeng/release:/var/www/html rinetd/php:apache

develop 9013

docker run -td --restart=always --name yimeng_apache_develop --link yimeng_mysql:mysql -p 9013:80 -v /var/www/yimeng/Uploads/:/var/www/html/Uploads/ -v /var/www/yimeng/develop:/var/www/html rinetd/php:apache

docker run -it --rm --name=nginx --net host -v $HOME/nnx:/etc/nginx:ro nginx

other

docker run -td --restart=always --name yimeng_apache --link yimeng_mysql:mysql -p 9011:80 -v /var/www/yimeng/www-data:/var/www/html rinetd/php:apache

docker run -d --restart=always --name yimeng_mysql -p 3306:3306 -v /var/www/yimeng/mysql:/var/lib/mysql mysql:5.6
docker run -d --restart=always --name yimeng_mysql -p 3306:3306 -v /var/www/yimeng/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=kyxx -e MYSQL_USER=yiming -e MYSQL_PASSWORD=yiming mysql:5.6

docker 配置

service docker start

MariaDB

alias mariadb='docker run --rm --name mariadb -p 3306:3306 -v /var/lib/mysql:/var/lib/mysql -v /var/run/mysqld:/var/run/mysqld mariadb:5.5'

pifa

chown -R nginx:nginx /var/lib/php/session
alias nginx='docker run -it --rm --name nginx_pifa -p 90:80 -v $PWD/default.conf:/etc/nginx/conf.d/default.conf -v $PWD:/usr/share/nginx/html nginx'
alias phpmyadmin='docker run --rm --name phpmyadmin -p 8080:80 -v /var/run/mysqld:/var/run/mysqld -e PMA_HOST=139.129.108.163 phpmyadmin/phpmyadmin'
################################################################################

  1. yum install tmux
    ---
    一、配置防火墙,开启80端口、3306端口

CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙。

1、关闭firewall:

systemctl stop firewalld.service #停止firewall

systemctl disable firewalld.service #禁止firewall开机启动

2、安装iptables防火墙

yum install iptables-services #安装

vi /etc/sysconfig/iptables #编辑防火墙配置文件

# sample configuration for iptables service
# you can edit this manually or use system-config-firewall
# please do not ask us to add additional ports/services to this default configuration
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

systemctl restart iptables.service #最后重启防火墙使配置生效
systemctl enable iptables.service #设置防火墙开机启动

二、关闭SELINUX

vi /etc/selinux/config

    #SELINUX=enforcing #注释掉
    #SELINUXTYPE=targeted #注释掉
    SELINUX=disabled #增加

setenforce 0 #使配置立即生效

LANMP

MySQL

yum install mariadb mariadb-server net-tools

systemctl start mariadb.service   #启动MariaDB
systemctl stop mariadb.service    #停止MariaDB
systemctl restart mariadb.service #重启MariaDB
systemctl enable mariadb.service  #设置开机启动
netstat -tap | grep mysql
mysql_secure_installation
cp /usr/share/mysql/my-huge.cnf /etc/my.cnf #拷贝配置文件(注意:如果/etc目录下面默认有一个my.cnf,直接覆盖即可)
`mysql -uroot -proot`

Apache

yum install httpd #根据提示,输入Y安装即可成功安装

systemctl start httpd.service #启动apache
systemctl stop httpd.service #停止apache
systemctl restart httpd.service #重启apache
systemctl enable httpd.service #设置apache开机启动

配置
vi /etc/httpd/conf/httpd.conf #编辑文件

ServerSignature On        #添加,在错误页中显示Apache的版本,Off为不显示
Options Indexes FollowSymLinks  #修改为:Options Includes ExecCGI FollowSymLinks(允许服务器执行CGI及SSI,禁止列出目录)
#AddHandler cgi-script .cgi #修改为:AddHandler cgi-script .cgi .pl (允许扩展名为.pl的CGI脚本运行)
AllowOverride None  #修改为:AllowOverride All (允许.htaccess)
AddDefaultCharset UTF-8 #修改为:AddDefaultCharset GB2312 (添加GB2312为默认编码)
#Options Indexes FollowSymLinks   #修改为 Options FollowSymLinks(不在浏览器上显示树状目录结构)
DirectoryIndex index.html   #修改为:DirectoryIndex index.html index.htm Default.html Default.htm index.php(设置默认首页文件,增加index.php)
MaxKeepAliveRequests 500  #添加MaxKeepAliveRequests 500 (增加同时连接数)
chown apache.apache -R /var/www/html
systemctl restart httpd.service #重启apache
rm -f /etc/httpd/conf.d/welcome.conf /var/www/error/noindex.html #删除默认测试页

Nginx

===
vi /etc/yum.repos.d/nginx.repo

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1

===
$ sudo rpm --import http://nginx.org/keys/nginx_signing.key
$ sudo rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
$ sudo yum install nginx

yum install nginx

systemctl enable nginx.service
systemctl start nginx.service

开放的HTTP和HTTPS防火墙中的端口
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd –reload

配置
vi /etc/nginx/nginx.conf
vi /etc/nginx/conf.d/default.conf
location ~ .php$ {

root           /usr/share/nginx/html;
try_files $uri =404;
  • fastcgi_pass 127.0.0.1:9000; #默认
  • fastcgi_pass unix:/var/run/php-fpm/php5-fpm.sock; #PHP-FPM使用Unix套接字
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    }
    vi /usr/share/nginx/html/info.php
    <?php
    phpinfo();
    ?>

systemctl restart nginx.service

PHP

yum install php
yum install php-fpm php-cli php-mysql php-gd php-ldap php-odbc php-pdo php-pecl-memcache php-pear php-mbstring php-xml php-xmlrpc php-mbstring php-snmp php-soap

vi /etc/php.ini #编辑

cgi.fix_pathinfo=0
date.timezone = PRC #把前面的分号去掉,改为date.timezone = PRC
disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname
#列出PHP可以禁用的函数,如果某些程序需要用到这个函数,可以删除,取消禁用。
expose_php = Off #禁止显示php版本的信息
short_open_tag = ON #支持php短标签
open_basedir = .:/tmp/  #设置表示允许访问当前目录(即PHP脚本文件所在之目录)和/tmp/目录,可以防止php木马跨站,如果改了之后安装程序有问题(例如:织梦内容管理系统),可以注销此行,或者直接写上程序的目录/data/www.osyunwei.com/:/tmp/

systemctl restart mariadb.service #重启MariaDB
systemctl restart httpd.service #重启apache

PHP-FPM使用Unix套接字
vi /etc/php-fpm.d/www.conf

  • ;listen = 127.0.0.1:9000
  • listen = /var/run/php-fpm/php5-fpm.sock
    user = nginx
    group = nginx

如果www-data用户不存在,那么先添加www-data用户
groupadd www-data
useradd -g www-data www-data

phpinfo()添加写入权限
session.save_path /var/lib/php/session
chmod +w /var/lib/php/session

systemctl restart php-fpm.service

curl -o sts-server.zip http://oss-demo.aliyuncs.com/app-server/sts-server.zip?spm=5176.docoss/practice/app_server/sts_server.2.12.viz9Kq&file=sts-server.zip

ruby

yum install ruby ruby-devel #2.0.0
gem install bundle
git clone https://github.com/rockuw/sts-app-server.git
bundle install

OSS

yum -y install git gcc gcc-c++ automake autoconf libtool make curl curl-devel openssl-devel apr apr-util apr-devel apr-util-devel cmake

yum -y install git
yum -y install gcc gcc-c++ automake autoconf libtool make
yum -y install curl curl-devel openssl-devel
yum -y install apr apr-util apr-devel apr-util-devel
yum -y install cmake
git clone https://github.com/chuckatkins/MiniXML.git
./configure && make && make install
git clone https://github.com/aliyun/aliyun-oss-c-sdk.git
cmake . && make

yum install git #
yum install openssl-devel #

yum -y install gcc gcc-c++ automake autoconf libtool make

#git clone https://github.com/zerotao/expat.git
#./configure && make && make install
#git clone https://github.com/apache/apr.git
#./buildconf
#./configure && make && make install

#git clone https://github.com/apache/apr-util.git
#git checkout 1.5.x
#./buildconf
#./configure --with-apr=/usr/local/apr/&& make && make install


  1. curl
    git clone https://github.com/curl/curl.git
    ./configure
    make
    make install
    yum install openssl-devel
    yum install autoconf
    执行./configure时默认是配置安装目录为/usr/local/,如果需要指定安装目录,请使用 ./configure --prefix=/your/install/path/
    如果要使用MEDIA-C-SDK,请确保./configure执行完后,最后一行的Protocols里面包含HTTPS,如果没有,请先安装openssl-devel等ssl开发包,然后重新安装libcurl。

    git clone https://github.com/peti/autoconf-archive.git

  2. apr
    git clone https://github.com/apache/apr.git
    ./configure
    make
    make install

    执行./configure时默认是配置安装目录为/usr/local/,如果需要指定安装目录,请使用 ./configure --prefix=/your/install/path/

3.
git clone https://github.com/apache/apr-util.git
./configure --with-apr=/your/apr/install/path
make
make install

执行./configure时默认是配置安装目录为/usr/local/,如果需要指定安装目录,请使用 ./configure --prefix=/your/install/path/
需要通过--with-apr指定apr安装目录,如果apr安装到系统目录下需要指定--with-apr=/usr/local/apr/
  1. MiniXML
    git clone https://github.com/chuckatkins/MiniXML.git
    ./configure
    make
    sudo make install

执行./configure时默认是配置安装目录为/usr/local/,如果需要指定安装目录,请使用 ./configure --prefix=/your/install/path/

  1. cmake
    git clone https://github.com/Kitware/CMake.git
    ./configure
    make
    make install

    注意:

    执行./configure时默认是配置安装目录为/usr/local/,如果需要指定安装目录,请使用 ./configure --prefix=/your/install/path/
    

    6.OSS C SDK的安装

典型的编译命令如下:

cmake .
make
make install

RAM (Resource Access Manerger)

[RAM初始设置]()

Easy darwin

To make recovery in case of failure easier, an additional sshd will
be started on port '1022'. If anything goes wrong with the running
ssh you can still connect to the additional one.
If you run a firewall, you may need to temporarily open this port. As
this is potentially dangerous it's not done automatically. You can
open the port with e.g.:
'iptables -I INPUT -p tcp --dport 1022 -j ACCEPT'

`