向文件追加内容 不改变原有内容
cat << EOF >> /etc/redis.conf
cat << EOF >> /etc/redis.conf
#######################config redis password##############
requirepass ancd1111
EOF
向文件写入 覆盖原有内容
cat << EOF > 单号覆盖原有
cat << EOF > /etc/nginx/nginx.conf
###############nginx.conf##############
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
########httpserver1#######
server {
listen 80;
server_name ratelie.com;
########httpserver#######
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files \$uri \$uri/ /index.html;
}
########httpserver#######
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-Real-PORT \$remote_port;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:20001/;
}
}
########httpserver1 end#######
}
###############nginx.conf##############
EOF
cat << EOF > 写入内容遇到特殊符号 需要转义
© 版权声明
文章版权归作者所有,未经允许请勿转载。