Skip to content

Instantly share code, notes, and snippets.

@manishjaingit
Created October 17, 2019 10:32
Show Gist options
  • Save manishjaingit/ff347e0154f5c056f40d6f3ba9c3a988 to your computer and use it in GitHub Desktop.
Save manishjaingit/ff347e0154f5c056f40d6f3ba9c3a988 to your computer and use it in GitHub Desktop.
create subdomain on nginx
first setup A record on your domain registar
sub.yourdomain.in 1800 IN A 13.232.209.111
for this you can refer this link https://www.godaddy.com/help/create-a-subdomain-4080
record type: A
host: sub
point to : your ip address of the server.
now
then create one directory /var/www/sub.domain.com
then create one empty file sudo nano /etc/nginx/sites-available/sub.domain.com
then add this lines
server {
listen 80;
root /var/www/sub.test.com;
index index.html index.htm index.nginx-debian.html;
server_name sub.test.com www.sub.test.com;
location / {
try_files $uri $uri/ =404;
}
}
sudo ln -s /etc/nginx/sites-available/crm.webtomarket.in /etc/nginx/sites-enabled/crm.webtomarket.in
(optional)
then i think you wanted to apply ssl here also
sudo certbot --nginx -d sub.domain.in ( do not write this -d www.sub.domain.in)
// this will write letsencrypt setting in /etc/nginx/sites-available/crm.webtomarket.in file now you just need to write php running script setting in it.
and all set.
best of luck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment