I'm using Vagrant to run a server for me. So I followed this tutorial and when I open up my browser to go check. I get Oops! Google Chrome could not connect to 127.0.0.1. I've also tried localhost and my IP address. Along with a mixture of different ports. The odd part is when I do
curl 'localhost' or curl 'http://127.0.0.1:80' I get
<html><body><h1>It works!</h1>
<p>This is the default web page for this server.</p>
<p>The web server software is running but no content has been added, yet.</p>
</body></html>
I do know that's normal, but I can only get that to show on the command line. Any ideas?
You must set up port forwarding in your Vagrantfile. See https://docs.vagrantup.com/v2/networking/forwarded_ports.html
Example:
Vagrant.configure("2") do |config|
config.vm.network "forwarded_port", guest: 80, host: 8080
end
I've had issues using Vagrant and got some help.
Here is my post and how i made it work:
Setting up Vagrant with PuPHET failure
Related
I have installed WAMP and my computer ip is http://192.168.1.142/
When I entered it in browser I got nothing, my WAMP server doesn't see this ip
I got error :
**This 192.168.1.142 page can’t be found
No webpage was found for the web address:
192.168.1.142 HTTP ERROR 404**
http://prntscr.com/fx1mri
Tried configure httpd.conf Want add there row Listen 192.168.1.142:80 and when I run restart WAMP it's not green , means apache doesn't run ,
How correct this ? Why my local IP can't reach in my browser ?
Probably there will be 2 approach to solve this-
You need to provide the ip-address instead of localhost in your code.
Try not to use Skype at the same time since it uses same port number.
If it's your local computer I'll recommend you to use "http://localhost" or "http://127.0.0.1". Prefer localhost.
If you want to use some other cool hostname you should add it to your (windows)hostfile %SYSTEMROOT%\System32\drivers\etc\hosts
Example of input:
127.0.0.1 localsecure
Other programs like skype and torrent are usually using the same ports. Go to your httpd.conf and change listen to for example 82 and the servername to localhost:82(the port is always the same as the value of listen). And than you can use localhost everywhere for example your phpmyadmin would be:
localhost:82/phpmyadmin
And the directories:
localhost:82/..
Credit: ndsmyter
I built a small chat using PHP and node.js (using the socket.io library)
Essentially I use node.js for the server of the chat and PHP to handle the actual webpages.
Vagrant has the option to share your HTTP server with users: https://www.vagrantup.com/docs/share/http.html
The HTTP server is running on port 80 and node.js is running on port 3000.
On the chat.php page, I have this line of code:
socket = io.connect("http://localhost:3000");
When I execute the vagrant share command, it provides a URL which you can provide to other people and they will be able to access the site.
So given that URL, I edit the line of code mentioned above to include that URL:
socket = io.connect("http://ugly-elk-1232.vagrantshare.com:3000");
and then I start SSH into vagrant and start node from there.
However it doesn't work. On the chat page I can see timeout errors when socket.io tries to access port 3000.
Here's the error I get in the console (in chrome):
GET http://ugly-elk-1232.vagrantshare.com:3000/socket.io/?EIO=3&transport=polling&t=Lcp9sZh net::ERR_CONNECTION_TIMED_OUT
(the URL is random and will change every time I run vagrant share, but I always update it on the chat page)
Here's what's in my vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "scotch/box"
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.hostname = "scotchbox"
config.vm.synced_folder ".", "/var/www", :mount_options => ["dmode=777", "fmode=666"]
config.vm.network "forwarded_port", guest: 3306, host: 3306
# Optional NFS. Make sure to remove other synced_folder line too
#config.vm.synced_folder ".", "/var/www", :nfs => { :mount_options => ["dmode=777","fmode=666"] }
end
Is there any way to make this work and allow port 3000 to be shared and not just port 80?
To be clear, the actual webpages are served perfectly fine. It's just that node is not accessible when I use vagrant share.
Edit:
I managed to somewhat solve the problem.
I use vagrant share --http 80 in one window and vagrant share --http 3000 in another.
Then I change the URL so that it connects to the node server that was shared on port 3000.
So the code then looks like this:
socket = io.connect("http://abc123.vagrantshare.com");
Including :3000 (the port) in the URL stops it from working. (not sure why, but I don't think this is the issue).
The problem now is that socket.io now resorts to polling and no longer uses websockets. I tried to force it to use websockets, but it gives 400 bad request every time it tries. Polling isn't necessarily bad and it works, but I wanted it to use websockets since I need to test how the site will behave when it's actually up and websockets are what will be used in that case.
because of
socket = io.connect("http://localhost:3000");
you're listening only locally and the app works only from your VM (it does not even work if you try to access it from your host machine)
If you want to share the app directly from port 3000 you should be able to run vagrant share as
vagrant share --http 3000
I'm trying to get my localhost XAMPP to broadcast over my IP address. localhost works fine but no luck getting it through to my IP.
I have HTTP TCP Port Forwarding on my router set to 80-8080.
How can I do this ? Any ideas?
I found some people suffering with the same problem. Some of them solved it by simply running the following command at windows CMD ( Be sure to run it as administrator ).
netsh http add iplisten 127.0.0.1
Good luck and keep me informed if it didn't work for you.
Figured it out... the HTTP Port Forward IP had to be the same IP as my server (connected device). = )
I have installed WampServer Version 2.4.9 on windows 7
Created a folder in wamp/www/myproject/index.php ,I am using user account(not admin account).The index.php conatins HTML code only,I tried with index.html too,but nothing worked.
The problem:
When I run localhost or phpmy admin by typing localhost in browser URL space then it shows the main window and then i click on project and get these messages:
This webpage is not available
when I click on more button in browser
The server at myproject can't be found, because the DNS lookup failed. DNS is the network service that translates a website's name to
its Internet address. This error is most often caused by having no
connection to the Internet or a misconfigured network. It can also be
caused by an unresponsive DNS server or a firewall preventing Google
Chrome from accessing the network.
I tried running from admin account too but that also did not worked.I tried running the application with off state of firewall too but that also did not work
EDIT:
I uninstalled xxamp ,I have apache tomcat too in my system that is used with JSP ,it takes 8080 port.but it is not running currently.The default port for wamp is 80,I tried running it on 81,8080,but both the thing didn't work.Skype also take port 80 so I exited from skype too...
when i type localhost/myproject,It worked.
but when I type localhost and then main page of wamp comes...and when click on localhost then the dns lookup failure occur that is written initially
check whether port 80 is free. You can check it in your apache conf file.
I have the following setup below:
Amazon EC2 instance.
IPs:
192.168.1.200 = eth0 = x.x.x.x public ip address
192.168.2.200 = eth1
Apps:
Apache
vhosts:
-domain.tld
PHP
The strange part is this. When I try to browse domain.tld over public ip address, its working fine. But when I browse it through 192.168.2.200, it will keep waiting until no display coming out in the browser. A simple index.php with a text "test" inside is working fine. Only when the php codes like phpinfo() will not be working.
Do you have any idea what could be the problem in php or apache or my network? I have already open all ports on the firewall but the problem still persist.
Thanks.
I found the issue - it's due to incorrect network routing table on the EC2 server including blocking of traffic that rectified through playing security settings.
Thanks to your comment #Dagon.