'Create nginx "sites-available" and "site-enabled" files along content using terminal commands

I have been assigned a task to automate the deployment process using digital ocean droplets. I am using doctl for creating the subdomain "A" record from my terminal using doctl commands. After creating subdomain "A" records I have to create a configuration file in the sites-available and sites-enabled folder with the same name as a subdomain "A" record. Can someone help me with how to create these files along with their configuration content inside using terminal commands?



Solution 1:[1]

Just moved to the directory (/etc/nginx/sites-available) and use the cat command following by the filename. Detail Here

cat << EOF > filename
line no 1 
line no 2 
line no 3 
EOF

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shafi