can not access website via localhost but 127.0.0.1 - apache

I was using virtual box and have had httpd installed on it, the network was configured as 'nat' and I forward port 8080 of Host Machine to port 80 of Virtual Machine.
Then I tried to access the Website hosted on the virtual machine via curl localhost:8080 -vv, but I got Empty reply from server, instead if I use curl 127.0.0.1:8080 -vv then everything is ok, why would it be like this ?

Related

Why is apache refusing requests from 127.0.0.1?

I am trying to restrict access to apache on one port (for example, 80) so that only the localhost can send requests (for example, for accessing APIs).
I have edited the /etc/apache2/ports.conf as
Listen 127.0.0.1:100
But when I call the API from localhost bash at one of the domains configured in apache, for example via
curl "https://www.example.com:100"
it returns
curl: (7) Failed to connect to www.example.com port 100: Connection refused
Why is it refusing even if the call is from localhost?

127.0.0.1 can't be reached with apache running

I set apache server to run on 8080 and 4433 ports (I changed all the references on 80 port in configuration files as well as all references on 443 port so apache can start). And in XAMPP application it says that apache server is normally running. MySQL server is running as well. There is a solid connection with internet so connection isn't a problem. But when I tried to access 127.0.0.1 this message appeared on display:
This site can’t be reached
127.0.0.1 refused to connect.
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED
How to solve this issue?
Apache won't re-read it's config file automatically after you change it so make sure you've restarted the service.
Also enter the url as http://127.0.0.1:8080 so the browser knows to connect on port 8080 rather than 80.

Cant' Access port 8080 from browser even if its open at 0.0.0.0

netstat -plnt shows that my port 8080 is listening at 0.0.0.0 but I can't access it with external IP where as localhost:8080 works just fine
If it shows this shouldn't I be able to access this using the servers IP using http://167.99.144.42:8080/ or do I need to forward the port for some reason.
I am using Apache2 on Ubuntu and Nodejs.
167.99.144.42 on port 8080 and 22 is working fine from the public Internet
There is probably a problem with access from your browser such as a local proxy

access web server from outside network with public ip

I have ubuntu virtual machine that connects to it remotely with public IP. I installed apache2 server on it. However I can't reach the server from the web browser. Can anyone tell what the security rule should I add to access the web page?
I tried
$sudo ufw allow in "Apache Full"
and
#sudo ufw allow 80/tcp

Browser can't find localhost while Apache and MySQL are up and running

I have reinstalled my Xampp Application, Apache is running on port 443 and 8080, MySQL is running on 3306.
If I go to Localhost, it still gives me a 404 Error while it should give me a message like "You have succesfully installed Xampp!"
What can be the problem?
If you omit the port, http uses port 80 by default and port 443 for https.
So try to call
http://localhost:8080
or
https://localhost
If this does not help you should check the accesslog of your webserver.