配置:Ubuntu/Nginx/Mysql/PHP,Git/Svn,Node/pip,mongoChef

Ubuntu

  • 背景改成豆沙绿:
    • /usr/share/themes/Ambiance/gtk-3.0/gtk-main.css
      • bg_color、base_color -> #CCE8CF
  • iptables开启端口:
    ufw enable。ufw default deny。
    ufw allow proto tcp from any to any port 80,443,8080:8090

Nginx

  • 泛解析:
    server {
    listen 80;
    server_name ~^www.(?<subdomain>.+).hxingxing.com$;
    root /var/www/html/hxingxing/$subdomain/public; 
    index index.html index.htm index.php;
    
    …… location ~ .php$ { try_files $uri =404; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param domain $subdomain; include fastcgi_params; } …… }

Mysql

  • 备份mysql远程数据库并清除一个月之前的数据:
    • hxingxing-backup.sh:
      date="$(date +"%Y-%m-%d")"
      mysqldump -u root -h localhost -p'' hxingxing | gzip -9 > "/root/db-backup/hxingxing-$date.gz"
    • cron
      01 1 * * * root /root/db-backup/hxingxing-backup.sh
  • mysql允许远程:
    • root使用密码123456,从任何主机连接:
      mysql>GRANTALLPRIVILEGESON*.* TO'root'@'%'IDENTIFIED BY'123456'WITH GRANTOPTION

      允许jack使用密码654321,从ip 10.10.50.127的主机连接

      mysql>GRANTALLPRIVILEGESON*.* TO'jack'@’10.10.50.127’ IDENTIFIED BY'654321'WITH GRANTOPTION;
      mysql>FLUSH RIVILEGES
  • Mariadb更新root密码:
    update user set plugin='' where User='root';
    flush privileges;

PHP

  • phpize:
    apt install php7.0-dev
  • 安装phalcon:
    curl -s https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh | sudo bash
    sudo apt-get install php7.0-phalcon

VCS

  • Git修改文件权限不影响文件git状态。132 3273 juli 5289
    git config core.fileMode false
  • SVN
    • 安装rabbitvcs:
      apt install rabbitvcs-cli rabbitvcs-core rabbitvcs-gedit rabbitvcs-nautilus 
    • /etc/subversion/config
      [tunnels]
      = ssh -p {port} -l {username}
    • ssh证书登录
      • svn客户端执行
        ssh-keygen -t rsa
        scp -P 13022 /root/.ssh/id_rsa.pub <svn帐号>@dibon.cetlab.org:/home/<svn帐号>
        cp /root/.ssh/id_rsa.pub /home/<本地用户>/.ssh/id_rsa.pub
        chmod -R 777 /home/<本地用户>/.ssh
      • svn服务端执行(ssh <svn帐号>@dibon.cetlab.org -p 13022)
        cat id_rsa.pub >> /home/<svn帐号>/.ssh/authorized_keys
        chmod 640 .ssh/authorized_keys

Package tool

  • Ubuntu下node库和nodejs冲突:
    sudo ln -s /usr/bin/nodejs /usr/bin/node
  • pip淘宝源:
    • vim ~/.pip/pip.conf
      [global]
      trusted-host = mirrors.aliyun.com  
      index-url = http://mirrors.aliyun.com/pypi/simple/

DB tool

  • mongoChef:http://3t.io/mongochef/download/core/platform/#tab-id-3
posted @ 2016-11-09 13:11  dingqing  阅读(383)  评论(0编辑  收藏  举报