A weird error appeared that all of a sudden http://localhost:8888/... is not available. A day ago it worked perfectly fine and now I get this error although I have not installed any software, nor updated MAMP nor updated my Operating System. I have been researching all day of what could be the problem and found several answers which solved other people's problem but sadly not mine. The question is: How can I get my localhost working again?
Once I enter the IP (http://127.0.0.1:8888) the website loads, however, all my links use http://localhost:8888, which means I would have to change all the links to use the IP. There are scripts that do so, but I really want to understand the background and find the root of this problem. I have tried several things:
Changing the Apache ports to another number which can be done under MAMP Preferences. I get the same error no matter which port I change it to.
Editing my etc/hosts file in order to link 127.0.0.1 to localhost, which I really did not have to do since the code was already there. After I have done this, I opened my terminal and entered sudo killall -HUP mDNSResponder in order to flush the DNS Cache. Afterwards, I restarted my computer and annoyingly the error keeps appearing. Somehow, localhost is not linked to 127.0.0.1, which I think is comparable to when the domain name of a website is not connected to the server IP which can be configured with the Nameservers. This brings me to my third point and last point.
I looked deeper into the location and opened the "httpd.conf" file found under the path "etc/apache2/httpd.conf" where I can configure the Apache HTTP Server. I searched for any ServerName and the only code that appears is some comments describing it. This includes #ServerName www.example.com:80 and a short description before. I've tried adding a new ServerName as ServerName localhost:8888 and even simply ServerName localhost, still nothing happens.
I've tried other obvious things which are not worthy mentioning for. This seems to me either something really complex to which my knowledge does not reach or something very silly I missed out.
For the record, the etc/hosts file contains some weird addresses:
##\n# Host Database\n#\n# localhost is used to configure the loopback interface\n# when the system is booting. Do not change this entry.\n##\n127.0.0.1 localhost\n255.255.255.255 broadcasthost\n::1 localhost \nfe80::1%lo0 localhost\n\n##SYS##\n127.0.0.1 inst.shoppingate.info\n127.0.0.1 service.shoppingate.info\n127.0.0.1 indexx.org\n127.0.0.1 f.flshbsjs.info\n127.0.0.1 gsy.testersgroupfun.com\n127.0.0.1 sendmessagebox.com\n127.0.0.1 t1.inskinad.com\n127.0.0.1 q.crbfmcjs.info\n127.0.0.1 static.donation-tools.org\n127.0.0.1 istatic.datafastguru.info\n127.0.0.1 static.boostsaves.com\n127.0.0.1 www.best-deals-products.com\n127.0.0.1 fge.solartrendinc.com\n127.0.0.1 nps.pastaleads.com\n127.0.0.1 digitaloptout.com\n127.0.0.1 cdncache-a.akamaihd.net\n127.0.0.1 cdncache1-a.akamaihd.net\n127.0.0.1 rvzr-a.akamaihd.net\n127.0.0.1 rvzr2-a.akamaihd.net\n127.0.0.1 asrv-a.akamaihd.net\n127.0.0.1 cdn.visadd.com\n127.0.0.1 a.visadd.com\n127.0.0.1 ydt.winsurfingclub.com\n127.0.0.1 client.foxydeal.com\n127.0.0.1 s.hklmm.com\n127.0.0.1 i.crbsjs.info\n127.0.0.1 wwm.determineyourroad.com\n127.0.0.1 ext1.engageya.com\n127.0.0.1 ext2.engageya.com\n127.0.0.1 a.tfxiq.com\n127.0.0.1 cdn.staticwebdom.com\n127.0.0.1 api.jollywallet.com\n127.0.0.1 i_crbsjs_info.tlscdn.com\n127.0.0.1 i_flshbsjs_info.tlscdn.com\n127.0.0.1 ppj.qwikbookprint.com\n127.0.0.1 homedesigntreasure.com\n127.0.0.1 www.superfish.com\n127.0.0.1 istatic.eshopcomp.com\n64.251.22.253 shmactustus.com\n64.251.22.253 www.google-analytics.com\n##SYS##
I also tried deleting all the remaining addresses leaving only:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
But, after I restart my computer, all the old addresses I previously deleted appear again and the error is still the same. The thing is, this happened all of a sudden overnight and I did not expect this to occur. Does anybody know what is going on? I am open to any suggestions and appreciate your help. Best Regards!!
Related
I changed my VM instance from "F1-micro" to "E2-micro". When I then restarted my machine, I couldn't access my webpage using the domain name, the webpage just shows an "Error 521" code - showing that my browser is working, CDN is working but the host has an erorr. When I paste the VMs IP address into my webpage, however, it show's the "Apache2 Debian Default Page".
Can somebody please help me with this?
The Error 521 message is caused by one of two situations:
First, check whether your WordPress site’s server is down. Even if everything else is configured properly, if your WordPress site’s server is offline, Cloudflare simply won’t be able to connect.
Second, your web server might be running fine but blocking Cloudflare’s requests. Because of how Cloudflare works, some server-side security solutions might inadvertently block Cloudflare’s IP addresses.
Cloudflare is a reverse proxy, all the traffic coming to your origin server will appear as if it’s coming from a small range of Cloudflare IPs (rather than each individual visitor’s unique IP address). Because of that, some security solutions will view high traffic from a limited number of IP addresses as an attack and block them.
Please check this link out in order to fix error 521 for Cloudflare and WordPress.
Turns out this problem was caused by my having installed the Debian Apache server package and it is causing collisions between it and the Apache shipped in the stack. Bitnami Stacks are completely self-contained and run independently of the rest of the software or libraries installed on your system.
So to fix this, all I had to do was run the following commands:
sudo systemctl stop apache2
sudo /opt/bitnami/ctlscript.sh restart
On my Nginx I've got two hosts.
One with the values
server_name = www.mydomain.com;
root /var/www/production/myFirstWebSite;
and the other with
server_name=localhost;
root /var/www/development/mySecondWebSite;
To my domain registrar account I configured the DNS with two A record "
www IN A myIP
IN A myIP
This is cool, i can reach my first website with www.mydomain.com or mydomain.com.
Now the problem is how to reach my second website which is in development and I don't buy the domain name. And myIP/development/myScondWebSite is no more working ...
I think that the problem come from the DNS entries but I'm not sure.
Do you've got some ideas ?
Thanks in advance.
There's a couple of ways I could think of to access the localhost one.
Creating a subdomain instead of localhost
This is the best one I'd recommend, try doing something like server_name localhost.mydomain.com.
If you need to put further security, you could make it only allow a certain IP(s) or a range of IPs.
Play with your hosts file
In this specific case I would not recommend this, because you're messing with localhost it self, might break some other stuff on your machine, if it was any other name I could have said it's fine.
Use an ssh tunnel to the server
In this method you create a dynamic port on your ssh connection and set your browser to pass all traffic through tunnel which goes to the server then it's handled from there, so if you run localhost for example it would be like running localhost from over there, but since this involved a browser setting, you need to remember to disable it after you disconnect the ssh connection otherwise the browser would return an error saying that the proxy server is refusing the connection.
Using a local Nginx as a proxy
This one I just came up with right now, and I can't say If it would work or not, the 3 before I've worked with before and I know they work.
You'd set a certain domain name that your local nginx would capture and then proxy it to the remote server, but edit the host header setting it to localhost instead, that way it would match the localhost in the remote machine, if this one works it would not need any setting to be turned on and off every time.
Out of all these, I'd recommend the first one first (if it's an option), then try the last one if you don't want to keep turning things on and off before and after each setting.
May be this is a weird question, but I am curious to know if single hosts file entry can contain multiple domains on same line?
I know that following is okay for host entry:
127.0.0.1 somedomain.com
But, I want to know if following would work:
127.0.0.1 somedomain.com, alternate-domain.com, subdomain.domain.com
or
127.0.0.1 somedomain.com, *.domain.com
(Note: I am doing hosts file entries on windows)
May be this has been asked before, but I googled before writing my question, and I didn't quite find a good answer. Thanks for taking time to read and answering, it will be pretty helpful.
I found the solution.
On IIS, I had to add https in bindings associating it to use IIS Development Certificate for SSL in my development environment.
Also, in the process I found that both of the following wiil work for me.
127.0.0.1 somedomain.com, alternate-domain.com, subdomain.domain.com
or
127.0.0.1 somedomain.com alternate-domain.com subdomain.domain.com
Spaces and commas both work, and I can add multiple domains, subdomains combinations on same line.
Also, if you are moving from a non-secure domain to secure domain/subdomain, SSL certificate needs to be setup on web server for it, else it would end up showing an error in the browser.
Cheers!
I am trying to run test and production sites in ASP.NET IIS config. I have following entries in my Hosts file:
172.16.5.178 testsite ### test site
172.16.170.41 www.mysite.com ### LIVE WEBSITE
I have two problems here: I can not navigate to my test site using IP Address or using "testsite" in browser. I tried using all combinations: http://testsite, http://mysite:8080, http://mysite:80, 172.16.5.178, 172.16.5.178:80 and so on. But none of them works for me.
If I however use following entry, it works correctly:
172.16.5.178 www.mysite.com ### test site
Note that I used Test Server IP Address and actual Name from Live Site, and it worked.
Can anyone tell me why is this happening? I thought writing in Hosts file will navigate to respective IP Address no matter what I use as name. And indeed it goes to that IP address but shows "Not Found" and "HTTP Error 404. The requested resource is not found." error.
Any help?
Editing your hosts file will basically send your browser to the designated IP address for that host/url. The destination IP address has to have something on the other end that is expecting that, if that makes sense.
If you set up a site in IIS on 172.16.5.178 called testsite, with a binding of testsite, then it would work fine, as it then knows what to do with that request. Then going to http://testsite will work. I'm assuming that's the part you are missing!
I've personally got plenty of development sites in my hosts file pointing to an IIS installation on a network server. You just need to make sure the destination server can work out what to do with testsite.
I'm using Windows 7 Pro and want to run my web project locally, but the url www.localhost.com does not work.
If use http://127.0.0.1:2710/default.aspx it works. I checked host file which in the C:\Windows\System32\Drivers\Etc\hosts folder. If I delete the rows:
# 127.0.0.1 localhost
# ::1 localhost
Nothing changes. How can I make www.localhost.com work on my machine?
Hope I understand your question correct. You want to acces your local site using www.localhost.com
Just edit the hosts file and add the following lines
127.0.0.1 www.localhost.com
I checked my Windows 7 hosts file and it has the following lines
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
Above lines are comments and deleting those lines does not do anything.
Note: If you get "Access denied" when you save the hosts file then open notepad as Administrator and then edit hosts file and save it. It should work
EDIT: The rows you deleted were just comments, so that doesn't matter.
Were you trying to enter your url just as localhost
or as http://localhost:2710/default.aspx?
The latter is probably necessary, as the 2710 is the port number, and without it will default to port 80, which probably doesn't have anything listening on it.
UPDATE: It might actually be an IPv6 thing, so try it with just this line in your hosts file:
127.0.0.1 localhost
You should not have a # at the beginning of the line, that will disable that line.
(You might need to reboot too).
You could also try pinging localhost (just type ping localhost in a command prompt window) and check that you get a reply from 127.0.0.1
Did you try:
http://localhost:2710/default.aspx ?
Okay, simply put, your web project will run on http://localhost:2710/default.aspx, once you put those lines you removed back into the hosts file (More on it here). To get to remove the port number, you need to reconfigure your web server.
Now, if you want to get a domain, that's a different thing altogether... then, you need to get a registrar and use DNS to get it to map to you. You would do this if you wanted other people to be able to use something like www.site.com to get to your site.