IT技术家园 - 系统服务
type: channel
link: https://www.itbunan.xyz/category/xtfw/
description: 系统服务相关部署
items: 支付系统Jeepay部署测试过程
items: docker启动nginx和tomcat
items: centos8安装jdk1.8和oracle19c
items: 基于docker运行Nacos单机版
items: 利用Caddy替代nginx提供web服务
items: web服务nginx的安装与常用配置
items: centos7系统下安装nginx+php服务
items: centos7部署rsync服务进行数据同步
items: 通过rsync同步日志数据-从windows到centos

支付系统Jeepay部署测试过程
type: item
date: 2024-08-29T07:28:00+00:00
description: {bilibili bvid="BV183HKejEDN" page="脚本运行视频"/}前言Jeepay是一套适合互联网企业使用的开源支付系统，支持多渠道服务商和普通商户模式。已对接微信支付，支付宝，云闪付官方接口，支持聚合码支付。{card-default label="运营后台" width="80%"}{/card-default}服务器准备一台配置为（4核+8G+2M+带宽）的VPS，本文只是测试所以采用 腾讯云 的竞价实例。预装ubuntu22.04的系统。{card-default label="竞价实例" width="80%"}{/card-default}一键安装脚本官方文档提供一键安装脚本，登录新建的服务器，直接执行。等待安装完成。apt update && apt-get -y install docker.io && apt-get -y install git && wget -O install.sh https://gitee.com/jeequan/jeepay/raw/master/docs/install/install.sh && sh install.sh官方文档地址登录验证登录运营平台，http://外网IP:19217。默认用户密码:jeepay/jeepay123。登录后即可添加支付接口。{card-default label="添加支付" width="85%"}{/card-default}项目地址【支付源码】支持聚合吗支付的支付系统Jeepay

docker启动nginx和tomcat
type: item
date: 2023-06-09T14:05:00+00:00
description: 前言利用docker启动tomcat，并用nginx做反向代理docker安装centos8安装docker和docker-composedocker-composeversion: "3" services: nginx: image: nginx:latest ports: - "80:80" - "443:443" restart: always volumes: - /etc/localtime:/etc/localtime:ro - ./app:/www/web - ./services/nginx/conf:/etc/nginx - /var/log/lnt/nginx:/www/web_logs networks: - lnet depends_on: - tomcat tomcat: image: tomcat:latest ports: - "8080:8080" volumes: - /etc/localtime:/etc/localtime:ro - ./app:/usr/local/tomcat/webapps - ./services/tomcat/config:/usr/local/tomcat/conf - /var/log/lnt/tomcat:/usr/local/tomcat/logs networks: - lnet networks: lnet: driver: bridgenginx配置{hide}upstream tomcat_server { server tomcat:8080; } server { listen 80 backlog=1024; server_name 0.0.0.0; root /www/web/; server_tokens off; access_log /www/web_logs/www_access.log wwwlogs; error_log /www/web_logs/www_error.log notice; client_max_body_size 50m; location / { proxy_pass http://tomcat_server; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; } location ~* \.(eot|ttf|woff|woff2|svg)$ { add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Headers X-Requested-With; add_header Access-Control-Allow-Methods GET,POST,OPTIONS; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } }{/hide}tomcat配置目录{message type="success" content="services/tomcat/config/"/}数据目录{message type="success" content="app/ROOT"/}验证app/ROOT目录下，创建index.html文件。内容为：test启动服务docker-compose up -d访问出现index.html中的内容即正常{card-default label="结果" width="75%"}{/card-default}

centos8安装jdk1.8和oracle19c
type: item
date: 2023-06-01T04:20:00+00:00
description: 前言记录centos8安装java和oracle环境的过程jdk1.8软件获取{hide}{cloud title="jdk1.8" type="bd" url="https://pan.baidu.com/s/12wh4E7Li2hIE1SnODc8Wew" password="eryr"/}{/hide}安装tar xvf jdk-8u301-linux-x64.tar.gz -C /usr/local/ ln -s /usr/local/jdk1.8.0_301/bin/java /usr/bin/java vim /etc/profile JAVA_HOME=/usr/local/jdk1.8.0_301 JRE_HOME=/usr/local/jdk1.8.0_301/jre PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib # 50几行 export JAVA_HOME JRE_HOME CLASSPATH PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL验证java -version jps{card-default label="java" width="75%"}{/card-default}oracle-19ccentos8安装docker和docker-compose,然后利用docker启动oracle-19cdocker安装centos8安装docker和docker-compose创建目录mkdir -p /data/oracle/oradata/ chmod 777 /data/oracle/oradata/oracle启动配置docker-compose.ymlversion: '3' services: oracle-db: image: registry.cn-hangzhou.aliyuncs.com/zhuyijun/oracle:19c container_name: oracle-db-19c ports: - "1521:1521" - "5500:5500" environment: - ORACLE_SID=ORCLCDB - ORACLE_PDB=ORCLPDB1 - ORACLE_PWD=ora@123 - ORACLE_EDITION=standard - ORACLE_CHARACTERSET=AL32UTF8 volumes: - /data/oracle/oradata:/opt/oracle/oradata{card-default label="成功" width="75%"}{/card-default}验证通过sqlplus验证docker exec -it oracle-db-19c bash sqlplus / as sysdba show pdbs;{card-default label="结果" width="75%"}{/card-default}通过web验证https://ip:5500/em {callout color="#f0ad4e"}账号密码:sys|ora@123|ORCLPDB1{/callout}{card-default label="登录" width="75%"}{/card-default}{card-default label="后台" width="75%"}{/card-default}

基于docker运行Nacos单机版
type: item
date: 2023-02-22T09:22:00+00:00
description: 前言Nacos是更易于构建云原生应用的动态服务发现、服务配置和服务管理平台。{card-describe title="Nacos特点:"}服务发现和服务健康检测动态配置服务动态DNS服务{/card-describe}部署数据库配{message type="success" content="使用自己已经运行的mysql服务，进行建库、授权、初始化等操作。"/}#登录 mysql -uroot -pxxxxx -h127.0.0.1 #建库 CREATE DATABASE `nacos` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; create user 'nosuser'@'%' IDENTIFIED BY 'nosuserxxx'; grant all privileges on nacos.* to 'nosuser'@'%'; flush privileges; #初始化 mysql -uroot -pxxxxx -h127.0.0.1 nacos < db/mysql-init.sql启动nacos单机版docker-compose.ymlversion: "3.8" services: nacos: image: nacos/nacos-server:${NACOS_VERSION} container_name: nacos-standalone-mysql env_file: - ./env/nacos-standlone-mysql.env volumes: - /var/log/nacos/:/home/nacos/logs ports: - "8848:8848" - "9848:9848" - "9555:9555" restart: alwaysnacos-standlone-mysql.envPREFER_HOST_MODE=hostname MODE=standalone SPRING_DATASOURCE_PLATFORM=mysql MYSQL_SERVICE_HOST=数据库IP地址 MYSQL_SERVICE_DB_NAME=nacos MYSQL_SERVICE_PORT=3306 MYSQL_SERVICE_USER=nosuser MYSQL_SERVICE_PASSWORD=nosuserxxx MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true启动docker-compose up -d测试web访问http://ip:8848/nacos/#/login 默认密码:nacos/nacos{card-default label="登录页" width="75%"}{/card-default}参考nacos-docker

利用Caddy替代nginx提供web服务
type: item
date: 2022-06-29T09:10:00+00:00
description: 前言发现了一款新的web服务器Caddy，看介绍使用和配置都非常简单就尝试一下。{card-default label="Caddy" width="75%"}{/card-default}部署系统直接安装基于AlmaLinux9版本dnf install 'dnf-command(copr)' dnf copr enable @caddy/caddy dnf install caddydocker方式安装参考： docker和docker-compose一键安装脚本docker-compose.ymlversion: "3.8" services: caddy: image: caddy:latest restart: always ports: - '80:80' - '443:443' environment: - 'SET_CONTAINER_TIMEZONE=true' - 'TZ=Asia/Shanghai' volumes: - ./conf:/etc/caddy - /opt/www/dl:/opt/www/dl - /var/log/caddy:/opt/logs networks: - caddy_net networks: caddy_net:Caddyfile配置{message type="success" content="文件服务器"/}:801 { encode zstd gzip root * /opt/res file_server { browse } }{message type="success" content="反向代理1"/}webzhan.xyz { tls admin@webzhan.xyz encode gzip log { output file /opt/logs/access.log } header / { Strict-Transport-Security "max-age=31536000;includeSubdomains;preload" } ## HTTP 代理配置 reverse_proxy fmail:3000 }{message type="success" content="反向代理2"/}v.webzhan.xyz { tls admin@webzhan.xyz encode gzip log { output file /opt/logs/v_access.log } reverse_proxy 172.23.0.1:81 file_server handle_errors { root * /etc/caddy/error rewrite * /error.html templates file_server } }{message type="success" content="php-fpm代理"/}v.webzhan.xyz { root * /www/web/v/ tls admin@webzhan.xyz encode gzip log { output file /opt/logs/v_access.log } php_fastcgi php:9000 { split .php index index.php } file_server handle_errors { root * /opt/caddy/error rewrite * /error.html templates file_server } }使用场景反向代理wordpress{message type="success" content="安装时跳转https报错，直接禁用当前域名的https，直接走前后端均走http协议"/}w.webzhan.xyz:80 { #tls admin@webzhan.xyz #header / { # Strict-Transport-Security "max-age=31536000;includeSubdomains;preload" #} encode gzip log { output file /opt/logs/w.log } ## HTTP 代理配置, ttrss服务IP地址+端口 reverse_proxy web:81 { header_up Host {host} header_up X-Real-IP {remote} header_up X-Forwarded-For {remote} header_up X-Forwarded-Port {server_port} header_up X-Forwarded-Proto {scheme} } }chrome浏览器清理https自动跳转浏览器地址栏输入 …

web服务nginx的安装与常用配置
type: item
date: 2022-05-13T10:14:00+00:00
description: 前言Nginx (engine x) 是一个高性能的HTTP和反向代理web服务器。其特点是占有内存少，并发能力强，事实上nginx的并发能力确实在同类型的网页服务器中表现较好，使用方面。精彩文章:万字总结，体系化带你全面认识 Nginx ！nginx平台初探(100%)基本使用安装#安装 yum -y install nginx ## 日志目录 mkdir /data/log/nginx/ && chown -R nginx:nginx /data/log/nginx/ ## 缓存目录 mkdir -p /var/cache/nginx/ && chown -R nginx:nginx /var/cache/nginx/配置文件{message type="success" content="配置文件 /etc/nginx/nginx.conf"/}user nobody; worker_processes auto; #nginx对外提供web服务时的worker进程数 error_log /data/log/nginx/error.log; pid /run/nginx.pid; # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; #设置可由一个worker进程同时打开的最大连接数 } http { 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 /data/log/nginx/access.log main buffer=32k flush=30s; server_tokens off; #关闭在错误页面中的nginx版本数字 client_max_body_size 100m; sendfile on; #可以让sendfile函数发挥作用。sendfile函数可以在磁盘和TCP socket之间互相拷贝数据(或任意两个文件描述符) tcp_nopush on; #告诉nginx在一个数据包里发送所有头文件，而不一个接一个的发送 tcp_nodelay on; #不缓存数据 keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; #ssl 配置 ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384; ssl_ecdh_curve secp384r1; ssl_prefer_server_ciphers on; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; ssl_session_tickets off; ssl_stapling on; ssl_stapling_verify on; add_header Strict-Transport-Security "max-age=63072000; preload"; add_header X-Frame-Options SAMEORIGIN; add_header X-Content-Type-Options nosniff; add_header X-XSS-Protection "1; mode=block"; #nginx缓存 fastcgi_cache_path /var/cache/nginx/ levels=1:2 keys_zone=wordpress:10m inactive=30m use_temp_path=off; fastcgi_cache_key $request_method$scheme$host$request_uri; fastcgi_cache_use_stale error ti…

centos7系统下安装nginx+php服务
type: item
date: 2022-04-03T09:45:00+00:00
description: {card-default label="php测试" width="80%"} {/card-default}前言nginx + php 用于运行大部分php开发的网站。前几篇文章，都是是运行与docker下的。如果系统不方便使用docker，直接在系统内配置 nginx+php服务安装软件yum install nginx yum install php php-xml php-mysql php-mongo php-redis php-memcache php-intl php-mbstring php-mcrypt php-pecl-swoole php-xcache php-pecl-xhprof php-fpm php-opcache配置php-fpm/etc/php.ini{hide}[PHP] engine = On short_open_tag = Off precision = 14 output_buffering = 4096 zlib.output_compression = Off implicit_flush = Off unserialize_callback_func = serialize_precision = 17 disable_functions = disable_classes = zend.enable_gc = On expose_php = On max_execution_time = 30 max_input_time = 60 memory_limit = 128M error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT display_errors = Off display_startup_errors = Off log_errors = On log_errors_max_len = 1024 ignore_repeated_errors = Off ignore_repeated_source = Off report_memleaks = On track_errors = Off html_errors = On variables_order = "GPCS" request_order = "GP" register_argc_argv = Off auto_globals_jit = On post_max_size = 256M auto_prepend_file = auto_append_file = default_mimetype = "text/html" default_charset = "UTF-8" doc_root = user_dir = enable_dl = Off file_uploads = On upload_max_filesize = 2M max_file_uploads = 20 allow_url_fopen = On allow_url_include = Off default_socket_timeout = 60 [CLI Server] cli_server.color = On [Date] [filter] [iconv] [intl] [sqlite] [sqlite3] [Pcre] pcre.jit=0 [Pdo] [Pdo_mysql] pdo_mysql.cache_size = 2000 pdo_mysql.default_socket= [Phar] [mail function] sendmail_path = /usr/sbin/sendmail -t -i mail.add_x_header = On [SQL] sql.safe_mode = Off [ODBC] odbc.allow_persistent = On odbc.check_persistent = On odbc.max_persistent = -1 odbc.max_links = -1 odbc.defaultlrl = 4096 odbc.defaultbinmode = 1 [Interbase] ibase.allow_persistent = 1 ibase.max_persistent = -1 ibase.max_links = -1 ibase.timestampformat = "%Y-%m-%d %H:%M:%S" ibase.dateformat = "%Y-%m-%d" ibase.timeformat = "%H:%M:%S" [MySQLi] mysqli.max_persistent = -1 mysqli.allow_p…

centos7部署rsync服务进行数据同步
type: item
date: 2022-03-30T08:16:00+00:00
description: 前言rsync的目的是实现本地主机和远程主机上的文件同步。安装yum install rsync配置{card-describe title="/etc/rsyncd.conf"}port = 873 use chroot = no uid = nginx gid = nginx max connections = 200 timeout = 600 pid file = /var/run/rsyncd.pid lock file = /var/run/rsyncd.lock log file = /var/log/rsyncd.log [games_frontend] path = /opt/project/gamestore/games_frontend/ ignore errors read only = no auth users = gameh5 secrets file = /etc/rsyncd.secrets{/card-describe}{card-describe title="/etc/rsyncd.secrets"}gameh5:Z@W8KtBL{/card-describe}启动systemctl enable --now rsyncd数据同步# 注意目录前后，防止数据被删除 rsync -azP --delete gameh5@172.16.4.10::c_h5 ./c_h5 --password-file=rsync.secrets{card-describe title="rsync.secrets"}Z@W8KtBL{/card-describe}{card-default label="结果展示" width="75%"}{/card-default}

通过rsync同步日志数据-从windows到centos
type: item
date: 2022-03-07T07:47:00+00:00
description: 前言介绍有一台服务器服务是部署在windows下的，平时linux用惯的人，在windows下不会干活了，于是折腾了半天，通过脚本每天将日志同步到centos下去分析。{card-describe title="系统版本信息"}windows server 2012R2centos 7.9cwRsyncServer_4.1.0{/card-describe}windows下安装CWRsync并配置软件下载地址：{hide}{cloud title="CWRsync下载" type="bd" url="https://pan.baidu.com/s/1HD7vahUf8s2lEjNeTPEbJg" password="g8aa"/}{/hide}安装目录 开始->程序->cwRsyncServer设置用户名密码SvcCWRSYNC RsyncUser123@ RsyncUser123@编辑 rsyncd.conf 服务配置文件use chroot = false strict modes = false hosts allow = xx.xx.xx.xx log file = rsyncd.log [superxpay] path = /cygdrive/c/publish read only = yes transfer logging = yes uid = 0 gid = 0启动{message type="success" content=" 输入 services.msc , 找到 RsyncServer 启动并设置为自动"/}{card-default label="rsync设置" width="75%"}{/card-default}centos 安装rsync客户端端口测试nc -z -v -w 10 xxx.xxx.xxx.xxx 873 配置rsync脚本cd /opt/scripts #密码文件 echo "RsyncUser123@" > .rsync_user.pwd && chmod 600 .rsync_user.pwd同步脚本 rsync_log.sh#!/bin/bash BACKUP_DIR="/data/superxpay" [ ! -d $BACKUP_DIR ] && mkdir -p $BACKUP_DIR rsync -avz --progress --delete --password-file=/opt/scripts/rsync_user.pwd SvcCWRSYNC@xx.xx.xx.xx::superxpay $BACKUP_DIR手动同步 sh /opt/scripts/sync_log.sh 编码转换脚本 gbk_to_utf.sh#!/bin/bash #提取最新日志，转换编码并输出到logs LOG_DIR='/data/superxpay' TO='./logs/' echo "=============update logs================" #管理后台日志 for f_group in {Manage,User} #多个文件 do for log_level in {Debug,Error,Info} #日志级别 do filename=`ls -l ${LOG_DIR}/ipay88.${f_group}/Log/${log_level} | tail -n 1 | awk '{print $9}'` iconv -f GBK -t UTF-8 ${LOG_DIR}/ipay88.${f_group}/Log/${log_level}/${filename} -o ${TO}/${f_group}-${filename} echo ${TO}/${f_group}-${filename} done done #管理后台日志 f_group='Web' for log_level in {Debug,Error,Info} #日志级别 do filename=`ls -l ${LOG_DIR}/iPay88.${f_group}/Log/${log_level} | tail -n 1 | awk '{print $9}'` iconv -f GBK -t UTF-8 ${LOG_DIR}/iPay88.${f_group}/Log/${log_level}/${filename} -o ${TO}/${f_group}-${filename} echo ${TO}/${f_group}-${filename} doneFAQwindow下rsync启动报错{message type="success" content="报错@ERROR: …