ifcfg-ens33网卡配置文件
TYPE=Ethernet
BOOTPROTO=none
NAME=ens33
DEVICE=ens33
ONBOOT=yes
IPADDR=10.0.0.206
PREFIX=24
GATEWAY=10.0.0.2
DNS1=223.5.5.5
下方说明--------------------------
BOOTPROTO=none ###采用静态IP配置
NAME=ens33 ###网卡名称为ens33
DEVICE=ens33 ###对应设备名为ens33
ONBOOT=yes ###开机启动该网卡
IPADDR=10.0.0.206 ###设置IP地址
PREFIX=24 ###子网掩码长度
GATEWAY=10.0.0.2 ###网关地址
DNS1=223.5.5.5 ###首选DNS服务器地址
Isync实时增量备份
settings {
logfile = "/var/log/lsyncd.log",
pidfile = "/var/run/lsyncd.pid",
statusFile = "/var/log/lsyncd.status",
nodaemon = true,
maxProcesses = 2
}
sync {
default.rsync,
source = "/data/",
target = "www_backup@172.16.1.204::backup",
delay = 1,
delete = true,
rsync = {
binary = "/usr/bin/rsync",
archive = true,
compress = true,
password_file = "/etc/rsync.password"
}
}
下方说明-------------------------------------
settings {
logfile = "/var/log/lsyncd.log" ### 设置日志文件路径
pidfile = "/var/run/lsyncd.pid" ### 指定进程 ID 文件路径
statusFile = "/var/log/lsyncd.status" ### 设定状态文件路径
nodaemon = true ### 不以守护进程方式运行
maxProcesses = 2 ### 最大进程数设为 2
}
sync {
default.rsync,
source = "/data/" ### 同步的源目录
target = "www_backup@172.16.1.204::backup" ### 同步的目标位置
delay = 1 ### 延迟时间
delete = true ### 允许删除目标多余文件
rsync = {
binary = "/usr/bin/rsync" ###rsync 命令路径
archive = true ### 启用归档模式
compress = true ### 开启压缩
password_file = "/etc/rsync.password" ### 密码文件路径
}
}
nfs数据一致性,网络挂载
/data/ 172.16.1.0/24(rw,sync,all_squash,anonuid=555,anongid=555)
下方说明-------------------------------------
/data/共享给172.16.1.0/24网段,权限为读写,同步写入。
采用all_squash,将所有访问用户映射为uid=555、gid=555的身份(包括匿名访问),以此规范该网段对/data/的访问与操作权限。
rsync增量备份
fake super =yes
uid = www
gid = www
use chroot = no
max connections = 2000
timeout = 600
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
ignore errors
read only = false
list = false
#host alllow = 10.0.0.0/24
#host deny= 0.0.0.0/32
auth users = www_backup
secrets file = /etc/rsync.user.password
##################################
[backup]
path = /nfs/
下方说明-------------------------------------
fake super =yes ###启用虚拟超级用户权限
uid = www ###设置运行用户的UID
gid = www ###设置运行用户的GID
use chroot = no ###不使用chroot环境
max connections = 2000 ###最大连接数设为2000
timeout = 600 ###超时时间设为600秒
pid file = /var/run/rsyncd.pid ###指定进程ID文件路径
lock file = /var/run/rsync.lock ###设定锁文件路径
log file = /var/log/rsyncd.log ###设置日志文件路径
ignore errors ###忽略错误
read only = false ###非只读模式
list = false ###不列出模块内容
#host alllow = 10.0.0.0/24 ###(注释部分,允许的主机网段)
#host deny= 0.0.0.0/32 ###(注释部分,拒绝的主机网段)
auth users = www_backup ###认证用户名为www_backup
secrets file = /etc/rsync.user.password ###密码文件路径
##################################
[backup] ###定义模块名为backup
path = /nfs ###模块对应的路径为/nfs
crontab定时任务
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
*/5 * * * * root ntpdate ntp2.aliyun.com &>/dev/null
下方说明-------------------------------------
SHELL=/bin/bash ### 指定默认 SHELL 为 bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin ### 设置命令搜索路径
MAILTO=root ### 邮件通知发送给 root 用户
*/5 * * * * root ntpdate ntp2.aliyun.com &>/dev/null ### 每 5 分钟同步一次时间
######
五颗星表示,分时日月周
/表示每
如果命令没有需要添加PATH,第二行
nginx配置文件
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 25532;
}
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;
}
server {
listen 80;
server_name www.haoshuaicong.com;
location / {
root /code;
index index.html;
}
}
# 下方说明-------------------------------------------------------------------
# 核心区块
user nginx; # 运行nginx的用户 安装nginx自动创建此用户
worker_processes auto; # nginx启动进程数量 以核心为准
error_log /var/log/nginx/error.log notice; # 错误日志的位置
pid /var/run/nginx.pid; # nginx的pid号写入到此文件中
#事件模块
events {
worker_connections 25532; # 每个进程最大的连接数
}
# http区块 接收浏览器请求 并且响应浏览器请求
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; # 长连接 65秒自动和浏览器断开
#gzip on; # 是否资源压缩
include /etc/nginx/conf.d/*.conf; # 将conf.d下的*.conf引入到当前的文件
}
# server区块,网站的配置。server区块是包含在http区块中。
server {
listen 80; # 监听的端口
server_name www.haoshuaicong.com; # 自己购买的域名 hosts解析
location / { # 路径匹配 www.haoshuaicong.com/
root /code; # 让用户去/code目录获取网站信息
index index.html; # 默认给浏览器返回的文件 index.html
}
}