备忘:mysql数据库建库及tomcat一些设置

>mysql -u root -p

>show databases;

--若没有新建一个
>CREATE DATABASE db1;

--使用数据库
>use library;

# 允许在172.16.0.1上登录
>create user 'alex'@'172.16.0.1' identified by 'password';

# 允许在172.16.0.X上登录
>create user 'alex'@'172.16.0.%' identified by 'password';

# 允许在任何ip上用户登录
>create user 'alex'@'%' identified by 'password';


# 指定任何ip的用户登录
grant all privileges on db1.t1 to "alex"@'%';

# 用户对db1数据库中的文件执行任何操作
grant all privileges on db1.* to "alex"@'%';

# 用户对所有数据库中文件有任何操作
grant all privileges on *.* to "alex"@'%';

# 刷新权限
>flush privileges;

 

=======================================================

# Set Java Envirement
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64

# set Tomcat Envirement
export TOMCAT_HOME=/usr/local/tomcat

 

# 显示验证码

修改tomcat的bin目录下的catalina.sh文件

修改 line:252的

JAVA_OPTS="$JAVA_OPTS $JSSE_OPTS"

为下列内容(增加  -Djava.awt.headless=true)

JAVA_OPTS="$JAVA_OPTS $JSSE_OPTS -Djava.awt.headless=true"

 

===============================================================

Nignx上http自动跳转到https

适用于 80端口和443 配置在同一个 server{}内

if ($server_port = 80) {
    rewrite ^(.*)$ https://$host$1 permanent;
}

 


配置示例:

server {
    listen       80;
    server_name  www.test.com;
    rewrite ^ https://$http_host$request_uri? permanent;
}

server {
    listen 443;
    server_name www.22.cn;  

    ssl on;
    ssl_certificate /etc/ssl/cacert.pem;
    ssl_certificate_key /etc/ssl/privkey.pem;

    server_tokens off;
    location / {
        fastcgi_param   HTTPS               on;
        fastcgi_param   HTTP_SCHEME         https;
    }
}

 

posted @ 2019-11-10 16:00  ★鹏的天空★  阅读(173)  评论(0编辑  收藏  举报