zoukankan      html  css  js  c++  java
  • 已经使用过的命令

    一.某个(8000)端口被占用?

    lsof -i:8000    查询该端口进程的 PID
    kill -9 PID 杀掉它

     二.git 切换分支

    git  branch -a   查询所有的分支
    git  checkout  -b  name  origin/name   切换到分支
    git pull 更新仓库代码

    或者
    git checkout 分支名称

     三. dcoker 如何运行 mysql 镜像

    docker search mysql 
    docker  pull mysql:5.7.26
    docker images
    docker run -p 3306:3306 --name mydb -v $PWD/conf:/etc/mysql/conf.d -v $PWD/logs:/logs -v $PWD/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7.26

     四.CentOS 7.x 防火墙状态查询与关闭

    firewall-cmd --state  查询防火墙状态
    systemctl stop firewalld.service   关闭防火墙
    systemctl disable firewalld.service 禁止开机启动
    参考:https://www.cnblogs.com/yyxq/p/10551274.html

     五. 后台启动 jar 与结束

    nohup java -jar  xxx.jar &  启动
     默认输出到:nohup.out
     输出重定向: nohup java -jar xxx.jar >>xxx.log &
     验证: jobs -l
    ps au 查询后台进程与 PID
    ps -ef 查询运行的进程
    kill -9 PID 杀死后台进程

     六.nginx 前后端分离配置

    conf/nginx.conf 主配置文件

    前端项目:/work/project/AgileIotUI 

    后端项目:/work/project/zoo.jar   

    后端restful接口:ip:8000/iot/**/**

    modele/*.conf 从配置

    worker_rlimit_nofile 65535;
    
    events {
        use epoll;
        worker_connections  65535;
      }
    
    http {
          include mime.types;
          server_tokens off;
          default_type application/octet-stream;
          log_format main  '$clientRealIp - $remote_user [$time_local] "$request" '
                   'fwf[$http_x_forwarded_for] tip[$http_true_client_ip] '
                   '$upstream_addr $upstream_response_time $request_time '
                   '$status $body_bytes_sent "$http_referer" '
                   '"$http_user_agent"';
    
    ## 这里取得原始用户的IP地址
    map $http_x_forwarded_for  $clientRealIp {
            ""      $remote_addr;
            ~^(?P<firstAddr>[0-9.]+),?.*$  $firstAddr;
     }
    
    
    
      server_names_hash_bucket_size 2048;
      client_header_buffer_size 512k;
      large_client_header_buffers 4 32k;
      client_max_body_size 8m;
      proxy_headers_hash_max_size 51200;
      proxy_headers_hash_bucket_size 6400;
    
    
    
      sendfile off;
      tcp_nopush on;
      keepalive_timeout 60;
      tcp_nodelay on;
      fastcgi_connect_timeout 300;
      fastcgi_send_timeout 300;
      fastcgi_read_timeout 300;
      fastcgi_buffer_size 128k;
      fastcgi_buffers 2 256k;
      fastcgi_busy_buffers_size 256k;
      fastcgi_temp_file_write_size 256k;
      gzip on;
      gzip_min_length 1k;
      gzip_buffers 4 16k;
      gzip_http_version 1.0;
      gzip_comp_level 2;
      gzip_types text/plain application/x-javascript  application/xml text/javascript application/javascript application/octet-stream;
      gzip_vary on;
    
     include /work/webserver/nginx/module/*.conf;
    
    }
    View Code
     server {
            listen      80;
            server_name  119.23.42.20;
            access_log   logs/build.log  main;
    
            #ssl on;        
            #ssl_certificate /usr/local/nginx/ssl/*.crt;
            #ssl_certificate_key /usr/local/nginx/ssl/*.key;
    
    location / {   
                    index        index.html index.htm;
                    root        /work/project/AgileIotUI; 
                    try_files $uri $uri/ /index.html;
            }
            location ^~ /AgileIotUI {
                    #gzip_static on;
                    root     /work/project;
                    expires max;
                    add_header Cache-Control public;
            }
            location ^~ /iot {
            proxy_pass http://119.23.42.20:8000/iot;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
            location ~ .*.(js|css|json)?$ {
            root  /work/project/AgileIotUI;
                    expires 15d;
                    access_log off;
            }
    
     }
    View Code

    七. 如何动态的读取日志文件

    tail -f  文件名
    tail  -fn  行数  文件名

     八.linux 命令 not found

    yum install tree   安装tree 命令
    yum install lrzsz 安装 rz sz 命令
    yum -y update 审计包 and 升级内核
    yum -y upgrade 只升级所以的包,不升级软件与内核
  • 相关阅读:
    [图解]在输入框和文本框中获取和设置光标位置,以及选中文本和获取选中文本值的方法 --- 详解,兼容所有浏览器。
    关于鼠标事件的screenY,pageY,clientY,layerY,offsetY属性 (详细图解)
    get新技能: 如何设置元素高度与宽度成特定比例。宽度改变,高度自动按比例改变。 例如设置宽高比16:9。
    jQuery源码 Ajax模块分析
    jQuery 1.9 Ajax代码带注释
    html5 自定义数据属性 ,也就是 data-* 自定义属性---笔记。
    client/scroll/offset width/height/top/left ---记第一篇博客
    JSON对象长度和遍历方法
    如何组织css,写出高质量的css代码
    css中文本框与按钮对不齐解决方案
  • 原文地址:https://www.cnblogs.com/bytecodebuffer/p/11239599.html
Copyright © 2011-2022 走看看