2

Simple when run npm run dev, adonisjs will run with domain:

http://localhost:3333

But i wanna config with domain:

http://blog.com http://blog.local

Please help me!!!

huy hoang
  • 43
  • 3

2 Answers2

2

Your question is not clear but I'll try to answer.

  1. If you are trying to get those domain names on your development machine, take a look at this: http://adonisjs.com/recipes/4.0/dev-domains

  2. If you are trying to host your Adonis app on a server, take a look at this: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04

Kessir
  • 871
  • 10
  • 8
0

If you are in development environment or local machine there is an answer here

But if your are in production environment you should install and config BIND9 or something like that to work as DNS Server but there is an alternative and simple solution:

Firstly register on http://cloudflare.com and add your domain on your dashboard. then it gives your two DNS you should set to your domain. then in the cloudflare dashboard create a A Record to point your domain to your server IP

Then install Nginx on your server to work as a Reverse Proxy and use this config to point your domain to your awesome adonisjs project:

server {
    listen 80;
    server_name blog.com;
    location / {
        proxy_pass http://localhost:3333;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

Enjoy!

agtabesh
  • 548
  • 3
  • 15
  • Spinning up a CDN and mapping DNS addresses is MASSIVE overkill for simply getting a site online. Running a DNS server is irrelevant. – symcbean Sep 26 '17 at 20:58