hi, i have a webserver with a dns and i installed wampserver on it with putin my website on www, the problem is
when i try to access from any computer with internet www.MyDomainName.com it work fine, then after a 2 or 3 min its wont and its says web page inaccessible, and while i enter on webserver machine with teamviwer and restart wampserver, and when i tape www.mydns.com its work then after 2 or 3 min its happend again, i tought i have aproblem with hosts file, here my hosts file looks like:
???,???,??,??? www.Mydns.com
127.0.0.1 www.Mydns.com

???,???,??,??? = my adresse ip sorry for many reason i cant show it up
www.Mydns.com = its just to show what i put in my hosts file not real dns

i hope someone can help me and thx in advance

Your information is not complete. Please let us know the following

Are you hosting your own site on your desktop?
Is your desktop IP address static?
Have you look into Uniform server, before deciding in using WAMP?
Which DNS service are you using?
Does it auto update as your IP changes?

**Instructions below DOES NOT APPLY for LINUX, UBUNTU and other linux derivative servers. ONLY for Windows serving Apache2,MySQL and PHP
**
if the above does not apply, which hosting company are you with? If you are not hosted by a hosting company, then this settings may help you.

hosts file in windows is for the local directives ONLY! Say, we have a development server in c:\wamp\htdocs\yourDomain\ and we want our browser to access it as www.YourDomain.com, then the entries on hosts file in c:\windows\System32\etc\hosts will be something like this

127.0.0.1 yourDomain.com

If you want your development site to access from the local network machines and EVEN from the Internet, then the entries for the virtualhost in wamp\apache\conf\httpd-vhosts.conf

will be something like this

<VirtualHost *:80>
        ServerAdmin webmaste@yourDomain.com
        DocumentRoot "C:/wamp/htdocs/YourDomain"
        ServerName YourDomain.com
        ServerAlias www.YourDomain.com *.YourDomain.com
        ErrorLog logs/YourDomain.com-error-log
        Custom logs/YourDomain.com-access.log common
 <Directory "/wamp/htdocs/YourDomain">
     Options Indexes FollowSymLinks Includes ExecCGI
     Order allow, deny
     Allow from all
 </Directory>

</VirtualHost>  

So, what I trying to tell you here is that if the YourDomain.com is a valid domain, then both of the directives I provided above will work for local access and Internet access to your website. PROVIDED that you change your nameserver directives on your domain control panel to your own nameserver. Otherwise, it is not going to work.

PLUS, if you already set the nameserver on your domain registrar control panel e.g godaddy etc.., you will still have to set your Internet Connection setting panel or your Internet connection router administration panel, MAKING the IP of your desktop where the WAMP resides assigned to port 80. So traffic regardless if it is from the local network or from the Internet gets re-routed to port 80 which then translate to the ip address found on the desktop.

That's pretty much I can help you with. Good luck to you.

first of all let me thx you for your help , i noticed after posting that article i would miss some information
Are you hosting your own site on your desktop?
the website on desktop windows 2012 r2
Is your desktop IP address static?
yes it is, the server(our machine in a company)
Have you look into Uniform server, before deciding in using WAMP?
Unifrom i dont know what it does actualy but i will check it
Which DNS service are you using?
org.dz
Does it auto update as your IP changes?
no
i already setup the <VirtualHost *:80>.. and <Directory> too
but still got this,
i forget to tell, that my friend was trying iis before i installed wamp, then it runes normaly period of 6days then
we got a automatic errors message its start with error 500, then it fixed alone, after that its show error 401.2 and its stacked like that, so i tought its a problem with firewall, i disabled them(kaspersky and windows) but nothiing happend then i truned off iis and attpi service i tought it could be something missconfiguration in that, i dint try what u give me yet i will thx mate.

You should run ipconfig on your command prompt whenever this type of error happens. It appears to me that it is an IP related problem. There is a much more reliable DNS service that will auto-update whenever your IP address changes. The free service is provided by freedns.afraid.org. They also provide auto-ip update through curl, wget, and direct url. I can't find the link but they also have a bat file that can run in the background and send any changes on your IP address for the domain names registered under your account.

I have suggested Uniform Server, because I honestly believe that this is more stable than any WAMP appliance ever created. Most WAMPP and XAMPP releases will not pass the suggested standards of live hosting. They solely designed for development with intra-network access.

I have no involvement with uniform server, but I think they cover many security vulnerabilities in running Apache, mysql, php in windows environment.

Some great options available in uniform server
can run a portable without relying so much on your windows resources
create a virtual host in an instant.
change the server configuration file from development to production server
error reporting can be disabled.
accessibility report internal and eternal (from the iternet).
IP checking.
Cron jobs
and many more.

Please take a look at the screenshot provided below running from USB drive and serving my client's development website. Yes, this tiny server can be access by my client from Europe and the rest of the QA people monitoring this project.

8b34d290d7567af528a5ac6bce58f9bb

There are too many options available for you. It is just a matter of knowing how things works.

For example, another alternative is to install the nginx inside the windows environment and then allow the nginx to trigger the apache server from the virtual box. So the Internet is not really accessing your nginx server , because it is only serving as a front-end server, but the actual files are served by the apache server inside the VM virtual box on a different IP. So, there isn't really a sustainable vulnerability there.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.