Score:0

add domain to server, virtualhosts

ae flag
Leo

I have ubuntu system on my server. i had php,composer, also laravel project and it's working well. but i have one problem. Everything is working on my server ip, but also i have domain. So i want all this on domain. When i go to domain it pops up:

 This site can’t be reached
 ERR_NAME_NOT_RESOLVED

Then i cleared browsers dns cache but not work. In my opinion it needs apache virtualhosts or something like this. So, i created my_domain.conf in (/etc/apache2/sites-available) and i have this code in this file:

<VirtualHost *:80>

 ServerAdmin [email protected]

 ServerName example.com

 ServerAlias example.com

 DocumentRoot /var/www/html

 ErrorLog ${APACHE_LOG_DIR}/error.log

 CustomLog ${APACHE_LOG_DIR}/access.log combined

 </VirtualHost>

(I have laravel project in /var/www/html and it's not problem). I runned in ssh sudo a2ensite example.com.conf and sudo a2dissite 000-default.conf. It has not problem, made this changes. Then restarted apache with this sudo systemctl restart apache2. And when i go to my domain nothing changes.

Score:1
za flag

ERR_NAME_NOT_RESOLVED indicates that your domain name cannot be resolved to IP address, meaning that you have to either create a A resource record in the DNS zone, you use /etc/hosts mapping to be able to reach your domain without that.

Leo avatar
ae flag
Leo
can you say to me how to make this?
drookie avatar
za flag
I can, but won't: at this point you need either to learn (all by yourself, using the internet) how this is done or hire someone to do this.
Score:0
ru flag

ERR_NAME_NOT_RESOLVED means your domain/hostname didn't correctly configured for pointing to your server, apache configurations have nothing to do with this. I'd recommend you to check your domain's records to make sure it's correctly pointed to the destination you want.

After you configured the domain, you could use nslookup to try resolve it (note that it might take a while for the DNS cache to expire before you actually getting the configured records)

$ nslookup google.com
Server:     8.8.8.8
Address:    8.8.8.8#53

Non-authoritative answer:
Name:   google.com
Address: 216.58.203.78
Name:   google.com
Address: 2404:6800:4005:805::200e

If you're new to the whole "making website" thingy, note that you'll need to rent both a "domain" and a "server" before you could let someone on the internet visiting your sites.

Leo avatar
ae flag
Leo
How to check, with which command or how to add or edit it?
minhng99 avatar
ru flag
The command is `nslookup`, have you bought a domain and know how to manage them? You'll need to add the server IP into the records list of that domain on the management panel from your registra
Leo avatar
ae flag
Leo
yes, i have domain and i have added already my server ip in managment panel. Also i runned command 'nslookup' and what should i do, it gives me > symbol
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.