類別: <span>Linux CentOS</span>

酸酸乳舔盖教程

1.ssrmu.sh

  1. 下载脚本,安装酸酸乳
    https://github.com/ToyoDAdoubiBackup/doubi

    wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubiBackup/doubi/master/ssrmu.sh && chmod +x ssrmu.sh && bash ssrmu.sh
  2. 修复 libsodium 脚本路径问题,或手动安装:
    https://github.com/jedisct1/libsodium/releases 依赖版本列表

    Libsodiumr_ver_backup="1.0.18"
    
    echo -e "${Info} 开始获取 libsodium 最新版本..."
    Libsodiumr_ver=$(wget -qO- "https://github.com/jedisct1/libsodium/tags"|grep "/jedisct1/libsodium/releases/tag/"|head -1|sed -r 's/.*tag\/(.+)\">.*/\1/')
    [[ -z ${Libsodiumr_ver} ]] && Libsodiumr_ver=${Libsodiumr_ver_backup}
    
    yum update
    echo -e "${Info} 安装依赖..."
    yum -y groupinstall "Development Tools"
    echo -e "${Info} 下载..."
    wget  --no-check-certificate -N "https://github.com/jedisct1/libsodium/releases/download/${Libsodiumr_ver}-RELEASE/libsodium-${Libsodiumr_ver}.tar.gz"
    echo -e "${Info} 解压..."
    tar -xzf libsodium-${Libsodiumr_ver}.tar.gz && cd libsodium-${Libsodiumr_ver}
    echo -e "${Info} 编译安装..."
    ./configure --disable-maintainer-mode && make -j2 && make install
    echo /usr/local/lib > /etc/ld.so.conf.d/usr_local_lib.conf

2.锐速魔改,tcp.sh

参考:https://www.moerats.com/archives/387/

wget -N --no-check-certificate "https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/tcp.sh" && chmod +x tcp.sh && ./tcp.sh

基于Linux+Nginx部署gitServer服务器

原帖:参考(https://www.cnblogs.com/wangxiaoqiangs/p/6179610.html

1.Git安装

  1. 获取gitHub编译安装包:https://github.com/git/git/releases
  2. 编译安装
    autoconf && ./configure && make && make install git --version

2.Git SSH 协议

  1. 创建 Git 仓库
    mkdir -p /data/git && cd /data/git
    git init --bare sample.git
    git update-server-info
  2. 客户端 clone 仓库
    git clone root@192.168.0.1:/data/git/sample.git
    # 输入 对应服务器 的 root 密码
    root@192.168.0.1's password:

3.Nginx安装与配置

  1. 安装(略:需额外安装扩展:–with-http_dav_module)
  2. 安装fcgiwrap
    git clone https://github.com/gnosek/fcgiwrap.git
    cd fcgiwrap && autoreconf -i && ./configure && make && make install
    vm /etc/init.d/fcgiwrap
    #! /bin/bash
    ### BEGIN INIT INFO
    # Provides:          fcgiwrap
    # Required-Start:    $remote_fs
    # Required-Stop:     $remote_fs
    # Should-Start:
    # Should-Stop:
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: FastCGI wrapper
    # Description:       Simple server for running CGI applications over FastCGI
    ### END INIT INFO
    
    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
    SPAWN_FCGI="/usr/local/bin/spawn-fcgi"
    DAEMON="/usr/local/sbin/fcgiwrap"
    NAME="fcgiwrap"
    PIDFILE="/var/run/$NAME.pid"
    FCGI_SOCKET="/var/run/$NAME.socket"
    FCGI_USER="www-data"
    FCGI_GROUP="www-data"
    FORK_NUM=5
    SCRIPTNAME=/etc/init.d/$NAME
    case "$1" in
        start)
            echo -n "Starting $NAME... "
            PID=`pidof $NAME`
            if [ ! -z "$PID" ]; then
                echo " $NAME already running"
                exit 1
            fi
            $SPAWN_FCGI -u $FCGI_USER -g $FCGI_GROUP -s $FCGI_SOCKET -P $PIDFILE -F $FORK_NUM -f $DAEMON
            if [ "$?" != 0 ]; then
                echo " failed"
                exit 1
            else
                echo " done"
            fi
        ;;
        stop)
            echo -n "Stoping $NAME... "
            PID=`pidof $NAME`
            if [ ! -z "$PID" ]; then
                kill `pidof $NAME`
                if [ "$?" != 0 ]; then
                    echo " failed. re-quit"
                    exit 1
                else
                    rm -f $pid
                    echo " done"
                fi
            else
                echo "$NAME is not running."
                exit 1
            fi
        ;;
        status)
            PID=`pidof $NAME`
            if [ ! -z "$PID" ]; then
                echo "$NAME (pid $PID) is running..."
            else
                echo "$NAME is stopped"
                exit 0
            fi
        ;;
        restart)
            $SCRIPTNAME stop
            sleep 1
            $SCRIPTNAME start
        ;;
        *)
            echo "Usage: $SCRIPTNAME {start|stop|restart|status}"
            exit 1
        ;;
    esac

    # 注意 spawn-fcgi 跟 fcgiwrap 脚本路径及 FCGI_GROUP 跟 FCGI_GROUP
    # 脚本启动了 5 个 cgi 进程,按需调整

  3. nginx server.conf配置

    server {
        listen      80;
        server_name git.server.com;
        #root        /usr/local/share/gitweb;    #gitWeb按需配置
        client_max_body_size 100m;
        auth_basic "Git User Authentication";
        auth_basic_user_file /usr/local/nginx-1.10.2/conf/pass.db;
        location ~ ^.*\.git/objects/([0-9a-f]+/[0-9a-f]+|pack/pack-[0-9a-f]+.(pack|idx))$ {
            root /data/git;
        }    
        
        location ~ /.*\.git/(HEAD|info/refs|objects/info/.*|git-(upload|receive)-pack)$ {
            root          /data/git;
            fastcgi_pass  unix:/var/run/fcgiwrap.socket;
            fastcgi_connect_timeout 24h;
            fastcgi_read_timeout 24h;
            fastcgi_send_timeout 24h;
            fastcgi_param SCRIPT_FILENAME   /usr/local/libexec/git-core/git-http-backend;
            fastcgi_param PATH_INFO         $uri;
            fastcgi_param GIT_HTTP_EXPORT_ALL "";
            fastcgi_param GIT_PROJECT_ROOT  /data/git;
            fastcgi_param REMOTE_USER $remote_user;
            include fastcgi_params;
        }
    
        #下面为gitweb配置
        try_files $uri @gitweb;
    
        location @gitweb{
            fastcgi_pass  unix:/war/ren/fcgiwrap.socket;
            fastcgi_param GITWEB_CONFIG   /etc/gitweb.conf;
            fastcgi_param SCRIPT_FILENAME /usr/local/share/gitweb/gitweb.cgi;
            fastcgi_param PATH_INFO       $uri;
            include fastcgi_params;
        }
    }
  4. 配置git用户表

    yum -y install httpd-tools
    cd /usr/local/nginx/conf
    htpasswd -c pass.db gituser  # 添加用户时执行 htpasswd pass.db username

5.gitWeb界面显示

  1. 配置gitWeb并启动
    vm /etc/gitweb.conf
    # path to git projects (<project>.git)
    $projectroot = "/data/git";
    
    # directory to use for temp files
    $git_temp = "/tmp";
    
    # target of the home link on top of all pages
    $home_link = $my_uri || "/";
    
    # html text to include at home page
    $home_text = "indextext.html";
    
    # file with project list; by default, simply scan the projectroot dir.
    $projects_list = $projectroot;
    
    # javascript code for gitweb
    $javascript = "static/gitweb.js";
    
    # stylesheet to use
    $stylesheet = "static/gitweb.css";
    
    # logo to use
    $logo = "static/git-logo.png";
    
    # the 'favicon'
    $favicon = "static/git-favicon.png";
  2. # 手动执行开是否报错,Status: 200 OK 正常,以下为报错及解决方法
    /usr/local/share/gitweb/gitweb.cgi

    2.1:

    Can't locate CPAN.pm in @INC (@INC contains: /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendorperl /usr/share/perl5/vendorperl /usr/lib/perl5 /usr/share/perl5 .) BEGIN failed--compilation aborted.
    yum -y install perl-CPAN

    2.2:

    Can't locate CGI.pm in @INC (@INC contains: /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendorperl /usr/share/perl5/vendorperl /usr/lib/perl5 /usr/share/perl5 .) BEGIN failed--compilation aborted.
    yum -y install perl-CGI

    2.3:

    Can't locate Time/HiRes.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/share/gitweb/gitweb.cgi line 20.
    yum -y install perl-Time-HiRes
  3. Gitweb-theme 样式
    git clone https://github.com/kogakure/gitweb-theme.git
    cd gitweb-theme
    ./setup -vi -t /usr/local/share/gitweb --install 
    # -t 指定 gitweb 根目录,一路 y 即可

日常php配置魔改【php.ini】

相对于一般php.ini扩展加载:

extension=php_curl.dll                        (curl扩展)
extension=php_gd2.dll                        (gd扩展)
extension=php_mbstring.dll
extension=php_mysqli.dll                   (mysqli扩展,7.0代替mysql)
extension=php_openssl.dll                 (openssl扩展)
extension=php_pdo_mysql.dll            (pdo扩展)

特殊设定:

max_input_vars = 2000;    (单次提交变量参数个数限制)
max_input_time = 60;        (提交响应时间)
max_execution_time = 30;(执行时间)

upload_max_filesize = 512M;(上传文件最大限制)
max_file_upload = 20;           (单次请求最大上传文件个数)

平滑重启php-fpm 7.0+

ps aux|grep php-fpm
kill -USR2 xxxxx

pkill php-fpm
./sbin/php-fpm

php编译扩展(php-redis实例)

wget -c https://github.com/phpredis/phpredis/archive/php7.zip
unzip php7.zip

cd phpredis-php7
/usr/local/php7/bin/phpize
./configure --with-php-config=/usr/local/php7/bin/php-config
make
make install

添加至”php.ini

extension=redis.so