I need to test my site on IE. I have Ubuntu installed. My Rails app is running on localhost:3000. Now, when I try to go to myIP:3000, I get the error:
Site can't be reached.
I had previously used the same IP to access the server, and it worked. I am not sure why it no longer works.
Is there a way to fix this to make it work as I expect? I don't want to push to Heroku every time I need to test on IE.
Method 1
Update:
No need to start with IP address. Thanks to Thorin. Starting server with 0.0.0.0 will do the trick.
rails server -b 0.0.0.0 -p 3000
On a linux machine, type ifconfig and note down your local IP.
Run your server like this
rails server -b 192.168.X.XXX -p 3000
where you pass your local ip to -b
Now make sure both the machines are connected to your local Wi-Fi. On your windows machine navigate to http://192.168.X.XX:3000
Method 2
Install wine in your ubuntu machine and install IE preferable version. Will be easier to access everything from a single machine.
Related
I'm trying to access localhost with specified port on my application on Cloud9 platform. I'm building a ruby on rails app, running a server with command below.
rails s -b $IP -p $PORT
I have a special occasion where I need to access a different port (not localhost:3000). Does anyone know how to do this?
Thanks for the help!
Cloud9 now has multiple external ports (released a few days ago but not yet documented). You can run a service on port 8081 or 8082 and it will be accessible by appending the relevant port to your preview url (e.g. http://project-user.c9.io:8081). Only http works for now, https will be available soon.
I recently have been having a problem with my AWS EC2 instances. The problem is that I cannot hit my Rails servers via public IP, but I can hit localhost and the server will respond.
Here's what I'm doing:
Create new EC2 instance (t2.micro, ubuntu free tier)
Security group has port 22, 80, 3000 open to everyone (0.0.0.0)
SSH to EC2 instance, install rails (I've been using this to install)
Start rails server after install, it's running on port 3000
run "wget localhost:3000" and it returns index.html, yay!
go to my web browser, type in EC2 instance public IP and port 3000 (IP:3000), says it can't connect :(
kill rails server, restart it on port 80, wget works but can't connect via public IP
as a sanity check, I install nginx and run it, and can see the nginx start page on port 80 via public IP... so confused...
So I'm thinking it has something to do with how I'm installing Rails, but I've tried methods other than using that install script but am encountering the same problem... I've even tried creating an entirely new AWS account just in case I screwed up the settings in my original account but haven't had any luck. I have previously been able to get rails running on EC2 instances just fine (in fact I have EC2 instances using the same security group running on my AWS account right now and can hit those public IPs just fine), but am now just banging my head against the wall... any help would be greatly appreciated!
EDIT: For now, I've configured nginx to hit my rails server.... at least that works for now... although I'm still curious why I can't hit my rails server directly...
Check if rails listens on 0.0.0.0 or 127.0.0.1, default is to listen only on localhost.
-b, --binding=IP Binds Rails to the specified IP.
Default: localhost
From the Ruby on Rails 4.2 Release Notes:
Due to a change in Rack, rails server now listens on localhost instead of 0.0.0.0 by default. This should have minimal impact on the standard development workflow as both http://127.0.0.1:3000 and http://localhost:3000 will continue to work as before on your own machine.
If you are using 'rails server' and want to use the default port 3000 then use below:
sudo rails server -b 0.0.0.0
it can be accessed as http://[public_ip]:3000.
If you want to use it as a URL without the port use the below to run the server:
sudo rails server -p 80 -b 0.0.0.0
You just access it as http://[public_ip].
I was running the rails server on default port 3000 on my AWS Ubuntu instance and had allowed this port in the security group, inbound section but still I was unable to access my application by using this.
http://public_ip:3000
I searched a lot and this answer helped me. Explaining the answer. We have to make firewall setting flexible so that our firewall allows port 3000.
You can use this command to check if this port is allowed on firewall or not.
$ sudo iptables -L | grep :3000
If you see nothing it means we have to allow it using this command.
$ sudo iptables -A INPUT -p tcp --dport 3000 -j ACCEPT
This worked for me to get my rails app access on port 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.
I try to host my ruby on rails app in my computer in Ubuntu but I cannot get it. I try to port forward from my router settings. I think I successfully forward the ports a source ports 80 - 8080 and destination port 3000. Then I start webrick in production mode. However, I could not open my app from internet by typing my external IP. How can I set my computer in proper way? Do you have any suggestions?
Thanks...
Try the following to help debug the issue:
From the same machine (you can use curl in place of wget if you'd like, as it's more powerful), make sure rails is running
$ wget http://localhost:3000
From the same machine, make sure the server is bound to an external ip address
$ ifconfig (lists the ip address a.b.c.d)
$ wget http://a.b.c.d:3000
From another machine on the same network, make sure you request the web page
$ wget http://a.b.c.d:3000
If the first step fails, rails might not be running. If the second step fails, then you might have an issue with how networking is setup, but you can try rails server -b a.b.c.d to see if that fixes it. If the last step fails, then you have an issue with your local network. Finally, if they all succeed, then the issue is either with your ISP or with your router.
I have got rails setup on linux (ubuntu)ami. I am trying to bind the ip used to access linux ami but am not able to bind it." Cannot assign requested address - bind(2) (Errno::EADDRNOTAVAIL) "
Full rails setup seems to be fine.
Am missing something here. The exact need is to access the rails app through different pc.
Plz point me to some ref.
I may not be fully understanding your request but starting your rails server on a particular port:
rails s -p 3000 #rails 3
script/server -p 3000 #rails 2
Then you should be able to access this on a different pc by going to:
http://yourmachinename:3000
If new Pc is on the same network. Otherwise have a look at your firewall settings and open up port 3000 and point it to the local IP of your machine (you can get this from ifconfig). Then get the external IP of your local network and go to:
http://your.external.ip:3000/