MySQL数据库连接配置模板
jdbc.driver=com.mysql.cj.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/数据库名称?useSSL=true&useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
jdbc.username=用户名
jdbc.password=密码
nginx配置模板
user root;
load_module /usr/lib/nginx/modules/ngx_stream_module.so;
worker_processes auto;
events {
worker_connections 1024;
accept_mutex on;
}
http {
include mime.types;
default_type application/octet-stream;
keepalive_timeout 75s;
gzip on;
gzip_min_length 4k;
gzip_comp_level 4;
client_max_body_size 1024m;
client_header_buffer_size 32k;
client_body_buffer_size 8m;
server_names_hash_bucket_size 512;
proxy_headers_hash_max_size 51200;
proxy_headers_hash_bucket_size 6400;
gzip_types application/javascript application/x-javascript text/javascript text/css application/json application/xml;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
# 内网穿透配置组;
listen 5003;
location /cy/ {
proxy_pass http://192.168.2.19:8088/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
server {
# 测试环境后台;
listen 5002;
location / {
root /home/nginxWebUI/www/test2/dist/;
index index.html;
try_files $uri $uri/ /index.html;
}
location /prod-api/ {
proxy_pass http://192.168.2.202:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /stage-api/ {
proxy_pass http://192.168.2.202:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /dev-api/ {
proxy_pass http://192.168.2.202:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/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 /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
【/etc/nginx/conf.d/服务名.conf;】
# 虚拟主机配置:https://www.jb51.net/server/294215o8n.htm
server {
listen 8090;
# 访问虚拟服务的域名,同一个端口可以绑定多个不同的虚拟服务
server_name XXX;
# 前端资源配置
location / {
# 配置前端资源的根目录
root /usr/share/nginx/html/XXX;
index index.html index.htm;
}
# 后台api配置
location /api/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# 后台接口地址
proxy_pass http://后台服务ip:端口/;
}
}