I need to create the file /opt/nginx/conf.d/default.conf with this content via shell script and create the file if it doesn't exist:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html;
}
How do I write multiline content via a shell script?
I created the directory
sudo mkdir -p /opt/nginx/conf.d
But I don't know how to write a file.