PHP website on Linux - server DNS address could not be found.

CipherIS
CipherIS used Ask the Experts™
on
I am creating a test environment of a website.  I copied what was in production and made modifications for the test environment.  I performed the following steps.

1.  On the server where the production website exists created directory test.mysite.com (example).
2.  Copied files from prod.mysite.com to test.mysite.com after making changes (e.g. dbase connections to point to test dbase instead of prod).
3.  edit apache2.conf file to include the test.mysite.com (example below).
<VirtualHost *:80>
        Header set Access-Control-Allow-Origin "*"
        DocumentRoot "/home/webserver/www/apitest.mysite.com"
        ServerName apitest.mysite.com
        <Directory "/home/webserver/www/apitest.mysite.com">
                Require all granted
        </Directory>
</VirtualHost>
<VirtualHost *:80>
        DocumentRoot "/home/webserver/www/test.mysite.com"
        ServerName test.mysite.com
        <Directory "/home/webserver/www/test.mysite.com">
                Require all granted
        </Directory>
</VirtualHost>

Open in new window


I also made sure that the file permissions for each folder matched the production permissions.

When I type URL test.mysite.com I receive server DNS address could not be found.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2015

Commented:
did you add a DNS record for test?
Distinguished Expert 2017

Commented:
Does nslookup test.mysite.com return an IP address?
If not, that is the issue.
If you do not want to update DNS records for testing, you can define the record on your local machine by adding it in /etc/hosts on Linux/Unix systems or in c:\windows\system32\drivers\etc\hosts (elevated editor required to open/edit)
Ip_address test.mysite.com

In this situation, the browser will get the information From the local file......
Most Valuable Expert 2015
Commented:
Adding it to /etc/hosts only works if you are local to the machine.

For it to work and test properly, add a DNS entry.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
How do I add a DNS entry on the linux server?
Most Valuable Expert 2015
Commented:
You add it to the zone for that domain.

Find out the registrar for your domain name and log in to the portal to add the record.

      dig soa mysite.com

substituting "mysite.com" with your real domain name on a linux machine (assuming that you have bind-utils installed).

Author

Commented:
So I need to go to the registrar for domain name?

I did the following.  I found the host file (in etc directory) and added the last two entries.  Below is an example.  There are other sites with the 123.0.1.1 IP (as an example).

123.0.1.1       apiprod.mysite.com #Existed
123.0.1.1       prod.mysite.com      #Existed

123.0.1.1       apitest.mysite.com  #Added
123.0.1.1       test.mysite.com       #Added

Open in new window

Author

Commented:
Below is what I receive when I try to access the webpage.
This site can’t be reached

test.mysite.com’s server DNS address could not be found.
Try running Windows Network Diagnostics.
DNS_PROBE_FINISHED_NXDOMAIN

Open in new window

Most Valuable Expert 2015
Commented:
Right.  Add a record in DNS -- not the hosts file.

Author

Commented:
@arnold when I open a command prompt and type

nslookup  test.mysite.com

I receive below

Server:  Unknown
Address:  10.x.x.x

*** UnKnown can't find test.mysite.com:  Non-existent domain

when I type below

nslookup prod.mysite.com

I don't receive the error.  It provides me with the IP address.

Author

Commented:
@Jan.  That is the below step?
You add it to the zone for that domain.

Find out the registrar for your domain name and log in to the portal to add the record.

      dig soa mysite.com

substituting "mysite.com" with your real domain name on a linux machine (assuming that you have bind-utils installed). 

Open in new window

If so, I will need to find the registrar.
Most Valuable Expert 2015
Commented:
The registrar will identify the name servers.  

Those name servers may belong to the registrar.  If they do, then make your changes there.

They may point to different servers.  If so, then that's where you make your changes.

Author

Commented:
Ugh.  Was hoping this would be easy.
Most Valuable Expert 2015

Commented:
Would you like to message me the domain name and I'll tell you what you need to know?
Distinguished Expert 2017

Commented:
If you are testing, follow the suggestion of adding
IP test.mysite.com
to the etc/hosts file applicable to your system and be done with it.

You can achieve the same on your local home machine if necessary.




use mxtoolbox.net or bettetwhois.com
enter your domain. there you will see the domain name servers responsible for your domain as well as the registrar through whom it is registered.  You would need to access that refistrar if you are using their name server and update the records in DNS adding test.mysite.com with an IP where the site is.
If you have a hosted proivder that is different from the registrar, you would usually either have a console to manage the domain's name server records, or would need to email them requesting that they add a record for test.mysite.com pointed to an IP.......

As Jan mentioned. to direct you explicitly on what you need to do, we need to know the domain name in question in order to direct you to the correct destination to get what you need.

Author

Commented:
I did enter test.mysite.com in etc/hosts and I am still receiving the error.
Distinguished Expert 2017

Commented:
Hopefully you realize that your response are not providing information. I have no access to what is going on in your system nor what you see.

What is the error you get is it that it can not reach the server or the server does not respond or unable to process the request.
Look at the Apache logs.

is the IP 123.0.0.1 supposed to represent a public IP or an internal IP?
If you use http://123.0.0.1 in your example what do you see?
telnet 123.0.0.1 80
HEAD http://test.mysite.com HTTP/1.1
REferer:
host:

Make sure if you run firewalld or iptables as the local sever firewall that you allow port 80 access.
I did enter test.mysite.com in etc/hosts...
What "etc/hosts" did you enter it into?
...and I am still receiving the error.
Where are you seeing the error?

Where is "test.mysite.com" in relation to where you receive the error? And where is "prod.mysite.com"? I see virtual hosts referenced, but where? All on the same hardware? In VMs? Other?

The networking relationships between all of the 'systems' that you seem to be referencing are very unclear. It's impossible to know what should be happening without a description of your environment.

Author

Commented:
What etc/hosts did you enter into
I believe it was on the etc directory and the hosts file is there

Where are you seeing the error
I was seeing the error in the browser when I would type test.mysite.com

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial