云服务安装

修改MySQL密码

修改本地 set password for root@localhost = password('11ea88sy@'); GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '11ea88sy@' WITH GRANT OPTION; https://www.cnblogs.com/benpaodexiaopangzi/p/6744494.html

tomcat 部署jar

对于SpringBoot打成的jar,我们想要在服务器上运行,只需要服务器有jdk即可,因为SpringBoot自带tomcat。 在服务器上运行打成的jar包,一般我们只需要执行:java -jar ****.jar 即可。

但是只是运行上面的jar的话,如果我们关掉了xshell之类的页面,该程序就会停掉,所以我们可以使用nohup对它进行后台运行:nohup java -jar ****.jar &即可

当然我们也可以在运行时指定很多参数,比如端口号等等,基本上在配置文件配置的参数我们都是可以指定的:nohup java -jar ****.jar --server.port=9091 &

上面运行的程序会默认将程序的所有日志打到jar包所在目录的nohup.out文件中,其中的日志非常详细,会导致日志很多,一个定时任务会每天产生上百G的日志,而我们基本会在程序中打印logger日志,该处的日志会显得比较冗余,这时候我们不需要该日志,由于暂时没有找到nohup命令不打日志的命令,后来想到可以利用linux的黑洞 也就是/dev/null关于这个,大家可以百度一下。所以如果我们不想要nohup日志,我们可以直接将日志打到黑洞里面:nohup java -jar ***.jar --server.port=9091 >/dev/null 2>&1 &。


mvn编译时不打测试包

mvn package -Dmaven.skip.test=true

CentOS 7 下Tomcat启动超慢的原因及解决方案 实测效果棒

1、[硬件随机数生成器]安装并使用rng-tools作为额外的熵随机数生成器
  • 安装rng-tools
    yum install rng-tools -y

  • 测试rngd
    rngd -f

  • 启动rngd
    systemctl start rngd

  • 设置自启动
    systemctl enable rngd

  • 查看自启动列表
    systemctl list-unit-files

2、[软件随机数生成器]使用haveged作为额外的熵随机数生成器

  • 检查是否需要 Haveged
    cat /proc/sys/kernel/random/entropy_avail
    如果结果比较低 (<1000),建议安装 haveged,否则加密程序会处于等待状态,直到系统有足够的熵。

  • 安装haveged
    yum install haveged -y

  • 启动haveged
    systemctl start haveged

  • 设置自启动
    systemctl enable haveged


nginx安装

安装依赖

yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
wget http://nginx.org/download/nginx-1.12.2.tar.gz

解压缩

tar -zxvf linux-nginx-1.12.2.tar.gz
cd nginx-1.12.2/

执行配置

./configure

编译安装(默认安装在/usr/local/nginx)

make
make install

#工作衍生进程数量
worker_processes 1;

#设置错误文件存放路径
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#设置pid存放路径(pid 是控制系统的重要文件)
#pid logs/nginx.pid;

#设置最大连接数
events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

#日志内容 combined(默认)
#log_format  combined  '$remote_addr - $remote_user [$time_local] "$request" '
#                  '$status $body_bytes_sent "$http_referer" '
#                  '"$http_user_agent" "$http_x_forwarded_for"';

#不保存日志
#access_log off 
#日志存放路径
#access_log  logs/access.log  combined;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;

#开启gzip 压缩
#gzip  on;

server {
    listen       80;
    server_name  localhost;
    
    #设置字符编码
    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
        root   html;
        index  index.html index.htm;
        #开启自动链目录
        autoindex on;
    }
    
    #配置缓存的清理时长
    #location ~.#\.(jpg|png)$ {
    #expires 30d;
    #}

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }

    # 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;
#    }
#}

}

抽象文件内容:

worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
}
}

图片上传

指定访问的路径 放在tomcat service.xml 中最后一行 Host 标签之前 docbase : 图片的存放路径 path:浏览器的路径 访问路径:xxxx:8080/img/xxx.jpg
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值