Sometimes it is troublesome to modify the configuration file in the container. vi
The file cannot be edited without commands.
Record vi
the commonly used commands when there is no
Example 1:
Adding configuration to the nginx service configuration file $host
is in the form of a variable. You only need to put the first one EOF
in quotes and it will not be escaped.
cat << 'EOF' >> default.conf
location ^~ /xxx {
proxy_set_header Host $host;
proxy_pass https://xxxxxxxxx;
}
EOF
Example 2:
Delete the last line of text
sed -i '$d' default.conf
Example 3:
Replace the specified content of the text.
The following command replaces the global aaa with bbb.
sed -i 's+aaa+bbb+g' default.conf