How to connect my domain name to the IP address of my server (Apache)

for example, I have a domain name www.example1.com

and I have this code in my apache conf:

<VirtualHost 109.201.175.107:80> DocumentRoot /home/localname/www ServerName www.example1.com # Other directives here </VirtualHost> 

in the virtual host, I wrote my ip and then I attach it to ServerName, is that right?, but in any case, when I open www.example1.com, it shows my 404 error, or maybe I need to change the ip address that is attached to the domain name, can you tell me step by step what I need to do, I searched all of Google, but did not understand.

+6
source share
4 answers
 <VirtualHost 109.201.175.107:80> ServerName example1.com:80 ServerAlias www.example1.com //other options ServerAdmin Email Id DocumentRoot /home/localname/www # Other directives here ErrorLog Physical path to error log folder </VirtualHost> 

Please check this for details http://bytes.com/serveradministration/webservers/apache/virtual-hosting/app/dynamic_static_router.html

+4
source

Your domain name must be mapped to the public IP address of your server, this is necessary after the configuration that you made. Ask your DNS provider for this.

at the ping command line of yourdomainname.com, it should resolve your public IP address (109.201.175.107)

+3
source

Solution for Ubuntu 15.04, I found a suitable solution and I hope that it will help you too.

 <VirtualHost *:80> ServerAdmin admin@example.com ServerName example.com ServerAlias www.example.com ServerAlias *.example.com DocumentRoot /var/www/example.com/public_html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> 

A source

+2
source

I believe that you also need to modify the hosts file.

Are you on a Mac or PC?

On my Mac, I have this under / etc / hosts

+1
source

Source: https://habr.com/ru/post/918327/


All Articles