https://nicknetvideos.com/blog/post/how-to-run-a-website-in-a-subdomain-in-digital-ocean
1. goto domains/dns, Add a domain
2. create an "A record" for your subdomain
3. create folder: /var/www/subdomain.example.com (create index.html)
4. create file: /etc/nginx/sites-available/subdomain.example.com
5. symlink to the enabled sites:
ln -s /etc/nginx/sites-available/subdomain.example.com /etc/nginx/sites-enabled/subdomain.example.com
6. To check the syntax of code in the server block is correct:
sudo nginx -t
7. Restart:
sudo service nginx restart
sites-available file, subdomain.example.com:
server {
listen 80;
listen [::]:80;
server_name api.domain.lt;
root /var/www/api.domain.lt/public;
index index.html index.php index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~ \.php$ {
try_files $uri $uri/ ;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
access_log /var/www/php-access.log;
}
}