linux 前端部署
linux.conf
user root; worker_processes 8; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name 0.0.0.0; #charset utf-8; #charset koi-utf; autoindex on; autoindex_exact_size off; autoindex_localtime on; #access_log logs/host.access.log main; location / { root ../path//web/dist/web; error_page 404 /; } location /fang { root /home/fang-site/www; error_page 404 /fang/; } location /mirrors { root /home/fang-site/www; } location /j-lunker { root /home/fang-site/j-lunker/www/; # redirection config for ngx-perfect-scrollbar rewrite ngx-perfect-scrollbar/dist/ngx-perfect-scrollbar\.js /j-lunker/node_modules/ngx-perfect-scrollbar/dist/index.js; rewrite ngx-perfect-scrollbar/dist/index$ /j-lunker/node_modules/ngx-perfect-scrollbar/dist/index.js; rewrite ngx-perfect-scrollbar/dist/lib/index$ /j-lunker/node_modules/ngx-perfect-scrollbar/dist/lib/index.js; rewrite ngx-perfect-scrollbar/dist/lib/(perfect-scrollbar\.\w+)$ /j-lunker/node_modules/ngx-perfect-scrollbar/dist/lib/$1.js; # redirection config for perfect-scrollbar rewrite /j-lunker/node_modules/perfect-scrollbar/(.*) /j-lunker/node_modules/ngx-perfect-scrollbar/node_modules/perfect-scrollbar/$1; # redirection config for rxjs rewrite rxjs/operators/index.js /j-lunker/node_modules/rxjs/operators.js; rewrite rxjs/operators/(\w+/\w+\.js.*) /j-lunker/node_modules/rxjs/$1; rewrite rxjs/operators/([A-Z]\w+\.js.*) /j-lunker/node_modules/rxjs/$1; # redirection config for @ngx-translate rewrite @ngx-translate/core/src/(translate\.\w+)$ /j-lunker/node_modules/@ngx-translate/core/src/$1.js; rewrite @ngx-translate/core/index$ /j-lunker/node_modules/@ngx-translate/core/index.js; rewrite @ngx-translate/core/src/util$ /j-lunker/node_modules/@ngx-translate/core/src/util.js; rewrite @ngx-translate/core/src/missing-translation-handler$ /j-lunker/node_modules/@ngx-translate/core/src/missing-translation-handler.js; } try_files $uri $uri/ /index.html?$args; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location /rdk/service { proxy_pass http://10.11.111.88:30000; } location /file-upload/service { proxy_pass http://10.11.111.88:3800; } location /xplan { proxy_pass http://10.11.111.88:40000; } location /test/fang-resource{ root /home/fang; #auth_basic "please input password:"; #auth_basic_user_file F:/.htpasswd; } #文件上传存放路径,及ux资源实时打包存放路径 location /fang-file{ root /home/fang; autoindex off; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }
stop.sh
#!/bin/sh DIRNAME=`dirname $0` HOME=`cd $DIRNAME/; pwd` UMS_HOME=`cd $DIRNAME/../../; pwd` _NGINXCMD="$HOME/nginx-linux-x86_32" OSNAME=`uname` if [ $OSNAME = "Linux" ]; then PLATFORM=`uname -p` if [ $PLATFORM = "x86_64" ] ;then _NGINXCMD="$HOME/nginx-linux-x86_64" else _NGINXCMD="$HOME/nginx-linux-x86_32" fi fi if [ $OSNAME = "AIX" ] ;then _NGINXCMD="$HOME/nginx-aix" fi if [ $OSNAME = "SunOS" ] ;then OSNAME2=`uname -m` if [ $OSNAME2 = "i86pc" ]; then _NGINXCMD="$HOME/nginx-solaris-x86" else _NGINXCMD="$HOME/nginx-solaris-sparc" fi fi echo =============================================================================== echo HOME=$HOME echo _NGINXCMD=$_NGINXCMD echo =============================================================================== cd $HOME; pwd echo @WORK_DIR@ $HOME echo @C_CMD@ nginx_id=`ps -ef | grep nginx | grep $_NGINXCMD | grep -v grep | awk '{print $2}'` echo $nginx_id worker_id_list=`ps -ef | grep nginx | grep $nginx_id | grep "worker process" | awk '{print $2}'` echo $worker_id_list $_NGINXCMD -p $HOME/ -s stop ps -p $nginx_id if [ $? -eq 0 ]; then kill -9 $nginx_id fi for worker_id in $worker_id_list do ps -p $worker_id if [ $? -eq 0 ]; then echo kill -9 $worker_id kill -9 $worker_id fi done
run.sh
#!/bin/sh DIRNAME=`dirname $0` HOME=`cd $DIRNAME/; pwd` UMS_HOME=`cd $DIRNAME/../../; pwd` _NGINXCMD="$HOME/nginx-linux-x86_32" OSNAME=`uname` if [ $OSNAME = "Linux" ]; then PLATFORM=`uname -p` if [ $PLATFORM = "x86_64" ] ;then _NGINXCMD="$HOME/nginx-linux-x86_64" else _NGINXCMD="$HOME/nginx-linux-x86_32" fi fi if [ $OSNAME = "AIX" ] ;then _NGINXCMD="$HOME/nginx-aix" fi if [ $OSNAME = "SunOS" ] ;then OSNAME2=`uname -m` if [ $OSNAME2 = "i86pc" ]; then _NGINXCMD="$HOME/nginx-solaris-x86" else _NGINXCMD="$HOME/nginx-solaris-sparc" fi fi echo =============================================================================== echo HOME=$HOME echo _NGINXCMD=$_NGINXCMD echo =============================================================================== cd $HOME; pwd echo @WORK_DIR@ $HOME echo @C_CMD@ $_NGINXCMD -p $HOME/
update.sh
#!/bin/sh echo "ued updating......."; sleep 60; cd $1; git reset HEAD .; git checkout .; git clean -xdf; git checkout master; git pull; echo "code already update!"; node $2"/main.js"; echo "ued content already update!"; git add -A; git commit -m 'Add Project Success'; git push origin master; echo "The file has been completed simultaneously!";
window run.bat
echo on title @if not "%ECHO%" == "" echo %ECHO% @if "%OS%" == "Windows_NT" setlocal set DIRNAME=. if "%OS%" == "Windows_NT" set DIRNAME=%~dp0% set ARGS= :loop if [%1] == [] goto endloop set ARGS=%ARGS% %1 shift goto loop :endloop set HOME=%DIRNAME% set _NGINXCMD=%DIRNAME%nginx.exe echo =============================================================================== echo HOME=%HOME% echo =============================================================================== cd /d "%HOME%" echo @WORK_DIR@%HOME% echo @C_CMD@ "%_NGINXCMD%"
window stop.bat
echo on title @if not "%ECHO%" == "" echo %ECHO% @if "%OS%" == "Windows_NT" setlocal set DIRNAME=. if "%OS%" == "Windows_NT" set DIRNAME=%~dp0% set ARGS= :loop if [%1] == [] goto endloop set ARGS=%ARGS% %1 shift goto loop :endloop set HOME=%DIRNAME% set _NGINXCMD=%DIRNAME%nginx.exe echo =============================================================================== echo HOME=%HOME% echo =============================================================================== cd /d "%HOME%" echo @WORK_DIR@%HOME% echo @C_CMD@ "%_NGINXCMD%" -s stop
“我相当乐意花一天的时间通过编程把一个任务实现自动化,除非这个任务手动只需要10秒钟就能完成”