Linuxcat<
蜜獾互联网 2025-01-07 12:00:29

向文件追加内容不改变原有内容

cat << EOF>>/etc/redis.conf

cat << EOF >> /etc/redis.conf#######################config redis password##############requirepass ancd1111EOF

向文件写入覆盖原有内容

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>写入内容遇到特殊符号 需要转义

0 阅读:1

蜜獾互联网

简介:聚焦国内外互联网前沿技术知识、技术分享咨询等领域。