I am learning Dart. I already installed Dart, and also the CLI tools (webdev and stagehand).
I successfully made a Dart console app and ran it without any issues. Then I started a bare-bones web app project and I ran the app with the following command:
webdev serve
And it started to run the web app in localhost on port 8080:
Serving web on http://127.0.0.1:8080
I already changed the forwarded port to 8080 in the vagrant file like this:
config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
But I still cannot access/view the Dart web app, so my best guest is that I am doing something wrong with the port forwarding. How can I access my Dart web app running in vagrant from the browser?
I am using an ubuntu box.
Related
I am trying to run a ror application at a friend's home and the application is not reachable from the outside. Here is what we have tried.
The application has been created with
$ rails new <application name>
and started with
$ rails server
The development server starts and is reachable on http://localhost:3000
Next thing we have activated port forwarding on the router he uses to connect to the internet: we have mapped the external port 3000 to port 3000 on the internal host on which the rails server is running. When I try to open the page from the outside (with firefox) I get an error page: unable to conenct to host, the host may be down, try to connect later.
Things we have tried:
Changed port forwarding 80 -> 80
Installed and started Apache: the default Apache page is reachable.
Stopped Apache and started the rails server on port 80 (with sudo, otherwise it can't use port 80): the rails server is not reachable.
I have also checked the firewall of the machine running the rails server. The OS is ubuntu 12.04: the firewall (at least ufw) is not active. I can also connect to that machine using port 22 / ssh.
Summarizing:
rails server is accessible on port 3000 on local host
port forwarding works for ports 22 and 80 and both ssh server and apache server are reachable
rails server is NOT reachable on both port 80 and 3000 from the outside
The only thing I can think of is that rails might have a mechanism similar to Django's ALLOWED_HOSTS and that it refuses external requests because they are for a different host than localhost. However, I haven't found anything on this topic. Also, the application's log files do not show any connection attempt that was refused by the rails server.
So we are out of ideas. What should we check next?
Prior to Rails 4.2, the default for rails server was to bind to all interfaces. In Rails 4.2 this changed to only bind to 127.0.0.1 by default - there's nothing in the application logs because the socket is simply not listening to connection on other network interfaces.
To allow connections from another machine you need to use the -b option to bind to extra ip addresses, eg
rails s -b 0.0.0.0
to bind to all available ip addresses. You can of course replace 0.0.0.0 with one of your machine's actual ip addresses although you would of course have to change that invocation whenever your machine's ip address changed.
My home server is running on Raspberry Pi with Rasbian (Debian for ARM)
There rails server is running: rvmsudo rails s -b ${LOCAL_IP} -p 80
It works perfectly fine to access from local machines, but it is not working when I am trying to access from outside of my local network
It should not be a router problem as I can easily access that server over ssh (both :22 and :80 are open in router preferences)
If you can access http via your local network ip, then it can be issue with router, look to port forwarding settings of DMZ.
BTW, router can use 80 port for its own purposes, like web interface. Try to bind to 8080 port for example.
As an alternative to share 80 port via internet you can use https://ngrok.com/
It allows you to share localhost http to anyone.
I recently updated my Ubuntu version in Vagrant from 12.xx to 14.04 and have also updated Guest Additions. I use VirtualBox and SSH into my development VM which primarily is used for Rails applications. The Rails server is listening on port 3000 which is also configured in the Vagrantfile as shown:
# config.vm.network "forwarded_port", guest: 3000, host: 3000
I have tried accessing 127.0.0.1:3000, localhost:3000, 10.0.2.2, tried using different ports, added exceptions to my Windows firewall, ran this:
iptables -I INPUT -p tcp --dport 1022 -j ACCEPT
I also tried different servers such as Unicorn and Thin in lieu of WEBrick rails server. I destroyed this VM and rebuilt/installed everything as well as upgraded to Ubuntu 14.04 yet again. I'm not sure why Windows won't display my stuff! Any ideas will be very appreciated. Thank you in advance. :-)
I have installed Vagrant and Virtualbox-4.3 on my Ubuntu system and windows 8 system and i want to run the ruby on rails project in the vagrant. How can i tunnel the project through the browser which in my machine.
If i run the rails project on port 3000 on vagrant. how can i see the result from my browser?
Do let me know to tunnel the result through the browser and to set the static ip for vagrant. Thanks in advance.
There are two ways, the first doesn't require any setup but, it will change every time that you start up your vagrant box.
ssh into you box (vagrant ssh)
Get the IP address of the box (ifconfig)
Open your web browser and go to <ip_address>:3000
A better way to do this is to specify a forwarded port. This way, you can always access your app in the same way. Add the config.vm.network network line like so,
Vagrant.configure("2") do |config|
config.vm.network "forwarded_port", guest: 3000, host: 3000
end
After adding that line, you'll need to reboot the box. You can do this by running vagrant reload. Once that process finishes, start up your app again. You will now be able to connect to your app by going to http://127.0.0.1:3000
Hello i am trying to access my Webrick rails server that i started on my ubuntu to my windows 7 pc locally. I checked on ifconfig in my virtual box and used the inet:10.0.2.15 when i run my rails server and also used port 80 like this:
rails server -b 10.0.2.15 -p 80
It didn't gave me an error in the terminal but when i try to go to 10.0.2.15 on my windows browser, it says it can't connect. I tried disabling the firewall in windows but still wont work. Thank you.
Choose another network type for your VM ubuntu. I suggest the Bridged Network. Reboot vm, it should obtain ip in same network as your windows host (example 192.168.0.XXX). Then you will be able reach your rails server from network At any port 80 or 3000.
Can you share your ubuntu with the vm, via the apache server too? is that started? In macs you have to enable web sharing (or something similar to that wording). ON ubuntu what happens when you do localhost:80... if i recall it should say it works! or something like that.