当前位置:论坛首页 > Linux面板 > 求助

(自行解决)BT如何编译secure link

发表在 Linux面板2017-9-27 13:48 [复制链接] 4 2790

本帖最后由 1499989946rgpo 于 2017-9-28 17:01 编辑

如何重新编译
secure link、fancy
使用道具 举报 只看该作者 回复
发表于 2017-9-27 17:06:26 | 显示全部楼层
不太建议重新编译,需要用原版本原配置来编译!

----------------------------------------------------------------------------------------------------
菜鸟团队技术博客点击联系
使用道具 举报 回复 支持 反对
发表于 2017-9-28 16:43:22 | 显示全部楼层
本帖最后由 1499989946rgpo 于 2017-9-28 16:59 编辑
penn 发表于 2017-9-27 17:06
不太建议重新编译,需要用原版本原配置来编译!

------------------------------------------------------ ...

算是自问自答了吧,答案在论坛搜索得来。操作如下:

环境:纯净centos环境 安装完面板,完成更改帐号密码端口。nginx、php、ftp、sql 均未装。

步骤一:
登录bt面板,使用文件管理功能切换至目录 /www/server/panel/install 新建文件 nginx.sh 黏贴以下代码保存。

代码超字数限制,2楼+3楼=nginx.sh
nginx.sh.zip (3.08 KB, 下载次数: 6153)
使用道具 举报 回复 支持 反对
发表于 2017-9-28 16:51:32 | 显示全部楼层
  1. #!/bin/bash
  2. PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
  3. export PATH
  4. CN='125.88.182.172'
  5. HK='download.bt.cn'
  6. HK2='103.224.251.67'
  7. US='128.1.164.196'

  8. CN_PING=`ping -c 1 -w 1 $CN|grep time=|awk '{print $7}'|sed "s/time=//"`
  9. HK_PING=`ping -c 1 -w 1 $HK|grep time=|awk '{print $7}'|sed "s/time=//"`
  10. HK2_PING=`ping -c 1 -w 1 $HK2|grep time=|awk '{print $7}'|sed "s/time=//"`
  11. US_PING=`ping -c 1 -w 1 $US|grep time=|awk '{print $7}'|sed "s/time=//"`

  12. echo "$HK_PING $HK" > ping.pl
  13. echo "$HK2_PING $HK2" >> ping.pl
  14. echo "$US_PING $US" >> ping.pl
  15. echo "$CN_PING $CN" >> ping.pl
  16. nodeAddr=`sort -V ping.pl|sed -n '1p'|awk '{print $2}'`
  17. if [ "$nodeAddr" == "" ];then
  18.         nodeAddr=$HK2
  19. fi

  20. Download_Url=http://$nodeAddr:5880

  21. Root_Path=`cat /var/bt_setupPath.conf`
  22. Setup_Path=$Root_Path/server/nginx
  23. run_path='/root'

  24. Download_Pcre(){
  25.         pcre_version=8.40
  26.     wget -O pcre-$pcre_version.tar.gz http://$nodeAddr:5880/src/pcre-$pcre_version.tar.gz -T 5
  27.         tar zxf pcre-$pcre_version.tar.gz
  28. }
  29. Install_Lua()
  30. {
  31.         if [ ! -f '/usr/local/bin/lua' ];then
  32.                 yum install libtermcap-devel ncurses-devel libevent-devel readline-devel -y
  33.                 wget -c -O lua-5.3.4.tar.gz ${Download_Url}/install/src/lua-5.3.4.tar.gz -T 5
  34.                 tar xvf lua-5.3.4.tar.gz
  35.                 cd lua-5.3.4
  36.                 make linux
  37.                 make install
  38.                 cd ..
  39.                 rm -rf lua-*
  40.         fi
  41. }

  42. Install_LuaJIT()
  43. {
  44.         if [ ! -d '/usr/local/include/luajit-2.0' ];then
  45.                 yum install libtermcap-devel ncurses-devel libevent-devel readline-devel -y
  46.                 wget -c -O LuaJIT-2.0.4.tar.gz ${Download_Url}/install/src/LuaJIT-2.0.4.tar.gz -T 5
  47.                 tar xvf LuaJIT-2.0.4.tar.gz
  48.                 cd LuaJIT-2.0.4
  49.                 make linux
  50.                 make install
  51.                 cd ..
  52.                 rm -rf LuaJIT-*
  53.                 export LUAJIT_LIB=/usr/local/lib
  54.                 export LUAJIT_INC=/usr/local/include/luajit-2.0/
  55.                 ln -sf /usr/local/lib/libluajit-5.1.so.2 /usr/local/lib64/libluajit-5.1.so.2
  56.                 echo "/usr/local/lib" >> /etc/ld.so.conf
  57.                 ldconfig
  58.         fi
  59. }

  60. Install_Nginx()
  61. {
  62.         cd ${run_path}
  63.         Run_User="www"
  64.     groupadd ${Run_User}
  65.     useradd -s /sbin/nologin -g ${Run_User} ${Run_User}
  66.         service nginx stop
  67.         mkdir -p ${Setup_Path}
  68.         rm -rf ${Setup_Path}/*
  69.         cd ${Setup_Path}
  70.         if [ ! -f "${Setup_Path}/src.tar.gz" ];then
  71.                 if [ "$nginx_version" == "openresty" ];then
  72.                         wget -O ${Setup_Path}/src.tar.gz ${Download_Url}/src/openresty-${openresty_version}.tar.gz -T20
  73.                 else
  74.                         wget -O ${Setup_Path}/src.tar.gz ${Download_Url}/src/nginx-$nginxVersion.tar.gz -T20
  75.                 fi
  76.         fi
  77.         tar -zxvf src.tar.gz
  78.         if [ "${nginxVersion}" == '-Tengine2.2.0' ];then
  79.                 mv tengine-2.2.0 src
  80.         elif [ "${nginxVersion}" == 'openresty' ];then
  81.                 mv openresty-${openresty_version} src
  82.         else
  83.                 mv nginx-$nginxVersion src
  84.         fi
  85.         cd src
  86.         git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module
  87.         git clone https://github.com/aperezdc/ngx-fancyindex
  88.        
  89.         wget -O openssl.tar.gz ${Download_Url}/src/openssl-1.0.2l.tar.gz -T 5
  90.         tar -xvf openssl.tar.gz
  91.         mv openssl-1.0.2l openssl
  92.         rm -f openssl.tar.gz
  93.         wget -O ngx_cache_purge.tar.gz ${Download_Url}/src/ngx_cache_purge-2.3.tar.gz
  94.         tar -zxvf ngx_cache_purge.tar.gz
  95.         mv ngx_cache_purge-2.3 ngx_cache_purge
  96.         rm -f ngx_cache_purge.tar.gz
  97.        
  98.         export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
  99.         if [ "${nginxVersion}" != "1.8.1" ];then
  100.                 if [ "${nginx_version}" == "1.12.1" ];then
  101.                         Install_LuaJIT
  102.                         #lua_nginx_module
  103.                         wget -c -O lua-nginx-module-master.zip ${Download_Url}/install/src/lua-nginx-module-master.zip -T 5
  104.                         unzip lua-nginx-module-master.zip
  105.                         mv lua-nginx-module-master lua_nginx_module
  106.                         rm -f lua-nginx-module-master.zip
  107.                        
  108.                         #ngx_devel_kit
  109.                         wget -c -O ngx_devel_kit-master.zip ${Download_Url}/install/src/ngx_devel_kit-master.zip -T 5
  110.                         unzip ngx_devel_kit-master.zip
  111.                         mv ngx_devel_kit-master ngx_devel_kit
  112.                         rm -f ngx_devel_kit-master.zip
  113.                         ./configure --user=www --group=www --prefix=${Setup_Path} --with-openssl=${Setup_Path}/src/openssl --add-module=${Setup_Path}/src/ngx_http_substitutions_filter_module --add-module=${Setup_Path}/src/ngx_devel_kit --add-module=${Setup_Path}/src/lua_nginx_module --add-module=${Setup_Path}/src/ngx_cache_purge --add-module=${Setup_Path}/src/ngx-fancyindex --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_gunzip_module --with-stream --with-stream_ssl_module --with-http_realip_module --with-http_secure_link_module --with-ld-opt="-Wl,-E"
  114.                 else
  115.                         if [ "$nginx_version" == "openresty" ];then
  116.                                 Download_Pcre
  117.                                 Install_LuaJIT
  118.                                 ./configure --user=www --group=www --prefix=${Setup_Path} --with-openssl=${Setup_Path}/src/openssl --with-pcre=pcre-${pcre_version} --add-module=${Setup_Path}/src/ngx_cache_purge --with-luajit --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_gunzip_module --with-stream --with-stream_ssl_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --with-ld-opt="-Wl,-E"
  119.                         else
  120.                                 ./configure --user=www --group=www --prefix=${Setup_Path} --with-openssl=${Setup_Path}/src/openssl --add-module=${Setup_Path}/src/ngx_cache_purge --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_gunzip_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --with-ld-opt="-Wl,-E"
  121.                         fi
  122.                 fi
  123.     else
  124.                 ./configure --user=www --group=www --prefix=${Setup_Path} --with-openssl=${Setup_Path}/src/openssl --add-module=${Setup_Path}/src/ngx_cache_purge --with-http_stub_status_module --with-http_ssl_module --with-http_spdy_module --with-http_gzip_static_module --with-http_gunzip_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --with-ld-opt="-Wl,-E"
  125.         fi
  126.         if [ "$nginx_version" == "openresty" ];then
  127.                 gmake && gmake install
  128.                 ln -sf /www/server/nginx/nginx/html /www/server/nginx/html
  129.                 ln -sf /www/server/nginx/nginx/conf /www/server/nginx/conf
  130.                 ln -sf /www/server/nginx/nginx/logs /www/server/nginx/logs
  131.                 ln -sf /www/server/nginx/nginx/sbin /www/server/nginx/sbin
  132.         else
  133.                 make && make install
  134.         fi
  135.         cd ../
  136.         if [ ! -f "${Setup_Path}/sbin/nginx" ];then
  137.                 echo '========================================================'
  138.                 echo -e "\033[31mERROR: nginx-${nginxVersion} installation failed.\033[0m";
  139.                 rm -rf ${Setup_Path}
  140.                 exit 0;
  141.         fi
  142.        
  143.     ln -sf ${Setup_Path}/sbin/nginx /usr/bin/nginx
  144.     rm -f ${Setup_Path}/conf/nginx.conf

  145.     wget -O ${Setup_Path}/conf/nginx.conf ${Download_Url}/conf/nginx.conf -T20
  146.     wget -O ${Setup_Path}/conf/pathinfo.conf ${Download_Url}/conf/pathinfo.conf -T20
  147.     wget -O ${Setup_Path}/conf/enable-php.conf ${Download_Url}/conf/enable-php.conf -T20
  148.     wget -O ${Setup_Path}/conf/enable-php-52.conf ${Download_Url}/conf/enable-php-52.conf -T20
  149.         wget -O ${Setup_Path}/conf/enable-php-53.conf ${Download_Url}/conf/enable-php-53.conf -T20
  150.         wget -O ${Setup_Path}/conf/enable-php-54.conf ${Download_Url}/conf/enable-php-54.conf -T20
  151.         wget -O ${Setup_Path}/conf/enable-php-55.conf ${Download_Url}/conf/enable-php-55.conf -T20
  152.         wget -O ${Setup_Path}/conf/enable-php-56.conf ${Download_Url}/conf/enable-php-56.conf -T20
  153.         wget -O ${Setup_Path}/conf/enable-php-70.conf ${Download_Url}/conf/enable-php-70.conf -T20
  154.         wget -O ${Setup_Path}/conf/enable-php-71.conf ${Download_Url}/conf/enable-php-71.conf -T20
  155.         ln -s /usr/local/lib/libpcre.so.1 /lib64/
  156.         ln -s /usr/local/lib/libpcre.so.1 /lib/
  157.         sed -i "s#include vhost/\*.conf;#include /www/server/panel/vhost/nginx/\*.conf;#" ${Setup_Path}/conf/nginx.conf
  158.         sed -i "s#/www/wwwroot/default#/www/server/phpmyadmin#" ${Setup_Path}/conf/nginx.conf
  159.         sed -i "/pathinfo/d" ${Setup_Path}/conf/enable-php.conf
  160.        
  161.         Default_Website_Dir=$Root_Path'/wwwroot/default'
  162.     mkdir -p ${Default_Website_Dir}
  163.     chmod +w ${Default_Website_Dir}
  164.     mkdir -p $Root_Path/wwwlogs
  165.     chmod 777 $Root_Path/wwwlogs

  166.     chown -R ${Run_User}:${Run_User} ${Default_Website_Dir}
  167.     mkdir -p ${Setup_Path}/conf/vhost
  168.        
  169.         mkdir -p /usr/local/nginx/logs
  170.         mkdir -p ${Setup_Path}/conf/rewrite
  171.         wget -O ${Setup_Path}/html/index.html ${Download_Url}/error/index.html -T 5
  172.     wget -O /etc/init.d/nginx ${Download_Url}/init/nginx.init -T 5
  173.     chmod +x /etc/init.d/nginx
  174.        
  175.         chkconfig --add nginx
  176.         chkconfig --level 2345 nginx on
复制代码
使用道具 举报 回复 支持 反对
发表于 2017-9-28 16:52:01 | 显示全部楼层

  1.        
  2.         cat > $Root_Path/server/panel/vhost/nginx/phpfpm_status.conf<<EOF
  3. server {
  4.         listen 80;
  5.         server_name 127.0.0.1;
  6.         allow 127.0.0.1;
  7.         location /nginx_status {
  8.                 stub_status on;
  9.                 access_log off;
  10.         }
  11.         location /phpfpm_52_status {
  12.                 fastcgi_pass unix:/tmp/php-cgi-52.sock;
  13.                 include fastcgi_params;
  14.                 fastcgi_param SCRIPT_FILENAME \$fastcgi_script_name;
  15.         }
  16.         location /phpfpm_53_status {
  17.                 fastcgi_pass unix:/tmp/php-cgi-53.sock;
  18.                 include fastcgi_params;
  19.                 fastcgi_param SCRIPT_FILENAME \$fastcgi_script_name;
  20.         }
  21.         location /phpfpm_54_status {
  22.                 fastcgi_pass unix:/tmp/php-cgi-54.sock;
  23.                 include fastcgi_params;
  24.                 fastcgi_param SCRIPT_FILENAME \$fastcgi_script_name;
  25.         }
  26.         location /phpfpm_55_status {
  27.                 fastcgi_pass unix:/tmp/php-cgi-55.sock;
  28.                 include fastcgi_params;
  29.                 fastcgi_param SCRIPT_FILENAME \$fastcgi_script_name;
  30.         }
  31.         location /phpfpm_56_status {
  32.                 fastcgi_pass unix:/tmp/php-cgi-56.sock;
  33.                 include fastcgi_params;
  34.                 fastcgi_param SCRIPT_FILENAME \$fastcgi_script_name;
  35.         }
  36.         location /phpfpm_70_status {
  37.                 fastcgi_pass unix:/tmp/php-cgi-70.sock;
  38.                 include fastcgi_params;
  39.                 fastcgi_param SCRIPT_FILENAME \$fastcgi_script_name;
  40.         }
  41.         location /phpfpm_71_status {
  42.                 fastcgi_pass unix:/tmp/php-cgi-71.sock;
  43.                 include fastcgi_params;
  44.                 fastcgi_param SCRIPT_FILENAME \$fastcgi_script_name;
  45.         }
  46. }
  47. EOF


  48.         #cat > ${Setup_Path}/conf/vhost/default.conf<<EOF
  49. #server {
  50. #        listen 80 default_server;
  51. #        server_name _;
  52. #        root $Setup_Path/html;
  53. #}
  54. #EOF


  55. cat > ${Setup_Path}/conf/proxy.conf<<EOF
  56. proxy_temp_path ${Setup_Path}/proxy_temp_dir;
  57. proxy_cache_path ${Setup_Path}/proxy_cache_dir levels=1:2 keys_zone=cache_one:20m inactive=1d max_size=5g;
  58. client_body_buffer_size 512k;
  59. proxy_connect_timeout 60;
  60. proxy_read_timeout 60;
  61. proxy_send_timeout 60;
  62. proxy_buffer_size 32k;
  63. proxy_buffers 4 64k;
  64. proxy_busy_buffers_size 128k;
  65. proxy_temp_file_write_size 128k;
  66. proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
  67. proxy_cache cache_one;
  68. EOF

  69. cat > ${Setup_Path}/conf/luawaf.conf<<EOF
  70. lua_shared_dict limit 10m;
  71. lua_package_path "/www/server/nginx/waf/?.lua";
  72. init_by_lua_file  /www/server/nginx/waf/init.lua;
  73. access_by_lua_file /www/server/nginx/waf/waf.lua;
  74. EOF
  75.        
  76.         rm -f ${Setup_Path}/conf/vhost/default.conf
  77.         mkdir -p /www/wwwlogs/waf
  78.         chown www.www /www/wwwlogs/waf
  79.         chmod 744 /www/wwwlogs/waf
  80.         mkdir -p /www/server/panel/vhost
  81.         wget -O waf.zip ${Download_Url}/install/waf/waf.zip
  82.         unzip -o waf.zip -d $Setup_Path/ > /dev/null
  83.         if [ ! -d "/www/server/panel/vhost/wafconf" ];then
  84.                 mv $Setup_Path/waf/wafconf /www/server/panel/vhost/wafconf
  85.         fi
  86.         cd ${Setup_Path}
  87.         rm -f src.tar.gz
  88.         CheckPHPVersion
  89.         sed -i "s/#limit_conn_zone.*/limit_conn_zone \$binary_remote_addr zone=perip:10m;\n\tlimit_conn_zone \$server_name zone=perserver:10m;/" ${Setup_Path}/conf/nginx.conf
  90.         if [ "${nginx_version}" == "1.12.1" ] || [ "${nginx_version}" == "openresty" ];then
  91.                 sed -i "s/mime.types;/mime.types;\n\tinclude proxy.conf;\n\t#include luawaf.conf;\n/" ${Setup_Path}/conf/nginx.conf
  92.         fi
  93.        
  94.         /etc/init.d/nginx start
  95.         echo "${nginxVersion}" > ${Setup_Path}/version.pl
  96. }

  97. CheckPHPVersion()
  98. {
  99.         PHPVersion=""
  100.         if [ -d "/www/server/php/52" ];then
  101.                 PHPVersion="52"
  102.         fi
  103.         if [ -d "/www/server/php/53" ];then
  104.                 PHPVersion="53"
  105.         fi
  106.         if [ -d "/www/server/php/54" ];then
  107.                 PHPVersion="54"
  108.         fi
  109.         if [ -d "/www/server/php/55" ];then
  110.                 PHPVersion="55"
  111.         fi
  112.         if [ -d "/www/server/php/56" ];then
  113.                 PHPVersion="56"
  114.         fi
  115.         if [ -d "/www/server/php/70" ];then
  116.                 PHPVersion="70"
  117.         fi
  118.         if [ -d "/www/server/php/71" ];then
  119.                 PHPVersion="71"
  120.         fi
  121.         if [ "${PHPVersion}" != '' ];then
  122.                 \cp -r -a ${Setup_Path}/conf/enable-php-${PHPVersion}.conf ${Setup_Path}/conf/enable-php.conf
  123.         fi
  124. }

  125. Uninstall_Nginx()
  126. {
  127.         service nginx stop
  128.         pkill -9 nginx
  129.         rm -rf $Setup_Path
  130.         chkconfig --del nginx
  131.         rm -f /etc/init.d/nginx
  132. }

  133. actionType=$1
  134. version=$2
  135. if [ "$actionType" == 'install' ];then
  136.         nginxVersion='-Tengine2.2.0'
  137.         if [ "$version" == "1.10" ] || [ "$version" == "1.12" ];then
  138.                 nginxVersion='1.12.1'
  139.                 nginx_version='1.12.1'
  140.         elif [ "$version" == "1.8" ];then
  141.                 nginxVersion='1.8.1'
  142.         elif [ "$version" == "openresty" ];then
  143.                 nginxVersion="openresty"
  144.                 nginx_version="openresty"
  145.                 openresty_version='1.11.2.4'
  146.         fi
  147.         Install_Nginx
  148. elif [ "$actionType" == 'uninstall' ];then
  149.         Uninstall_Nginx
  150. fi
复制代码
使用道具 举报 回复 支持 反对
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

普通问题处理

论坛响应时间:72小时

问题处理方式:排队(仅解答)

工作时间:白班:9:00 - 18:00

紧急运维服务

响应时间:3分钟

问题处理方式:宝塔专家1对1服务

工作时间:工作日:9:00 - 18:30

宝塔专业团队为您解决服务器疑难问题

立即付费处理

工作时间:09:00至24:00

快速回复 返回顶部 返回列表