How to get the server Ip address dynamically. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Can you elaborate on what you are trying to accomplish? On May 21, 9:18 pm, "Mr. Bless" <rananirv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> How to get the server Ip address dynamically.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mr. Bless wrote:> How to get the server Ip address dynamically.what operating system do u use?...do u have a dhcp server in your network? if you have a dhcp server and your server operating system is linux, then type dhclient in the terminal...it will fetch you a ip address dynamically... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I am using window. My requirement is to send the email with the link including activation code when the user sign up for an account. Right now it sends http://localhost:3000/activation_code now I want to include server ip address instead of localhost On May 22, 12:28 pm, Mahalingam Mr <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Mr. Bless wrote: > > How to get the server Ip address dynamically. > > what operating system do u use?...do u have a dhcp server in your > network? > > if you have a dhcp server and your server operating system is linux, > then type > > dhclient in the terminal...it will fetch you a ip address dynamically... > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
mrbless wrote:> I am using window. My requirement is to send the email with the link > including activation code when the user sign up for an account. Right > now it sends http://localhost:3000/activation_code now I want to > include server ip address instead of localhost > > On May 22, 12:28 pm, Mahalingam Mr <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>if the server is in windows look for the httpd.conf file in it & edit the servername from localhost to your servers ip address.. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mahalingam Mr wrote:> mrbless wrote: >> I am using window. My requirement is to send the email with the link >> including activation code when the user sign up for an account. Right >> now it sends http://localhost:3000/activation_code now I want to >> include server ip address instead of localhost >> >> On May 22, 12:28 pm, Mahalingam Mr <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > if the server is in windows look for the httpd.conf file in it & edit > the servername from localhost to your servers ip address..I believe the original poster is wanting to know how to do it dynamically. I use the following method to build URLs: require ''ipaddr'' def wgg_build_url(resource) begin ip = IPAddr.new(request.host) rescue ip = nil end root_url if ip && ip.ipv4? "#{request.protocol}#{request.host}#{request.port_string}" else sub_domain = request.subdomains.first ? "#{request.subdomains.first}." : '''' "#{request.protocol}#{sub_domain}#{request.domain}#{request.port_string}" end resource[0] = '''' if resource.at(0) == ''/'' return "#{root_url}/#{resource}" end It''s something I wrote, so feel free to use it, rename it, change it, whatever. Peace, Phillip -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Okay I hate to ask for more details but the server ip address can be several things. First of all the IP address that your RoR web server is binding to may not be the correct IP address depending on what you are trying to do. If you are going to access your web server from your internal network, then yes the IP address that your RoR web server is binding to will most likely be the correct one. However, if your web server is serving requests to the outside (for example, to others on the internet) you will most likely have a different "server" IP address that is provided to you by your ISP (this would be your public IP address). Then you must make sure that you have the appropriate port mapping rules (eg. firewall rules) that will route port 80 (or any port like 3000) on the public IP address to your computer''s IP address''s port 3000 that is running the RoR web server. In either case, if you are using apache I would change the ''servername'' (also suggested by Mahalingam) to the either one of the two possible IP address I mentioned above, either the local computer''s internal IP address or the public IP address. Thanks, Gregg On May 22, 1:28 am, mrbless <mrbl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I am using window. My requirement is to send the email with the link > including activation code when the user sign up for an account. Right > now it sendshttp://localhost:3000/activation_codenow I want to > include server ip address instead of localhost > > On May 22, 12:28 pm, Mahalingam Mr <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > > > Mr. Bless wrote: > > > How to get the server Ip address dynamically. > > > what operating system do u use?...do u have a dhcp server in your > > network? > > > if you have a dhcp server and your server operating system is linux, > > then type > > > dhclient in the terminal...it will fetch you a ip address dynamically... > > -- > > Posted viahttp://www.ruby-forum.com/.On May 22, 4:02 am, Mahalingam Mr <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> mrbless wrote: > > I am using window. My requirement is to send the email with the link > > including activation code when the user sign up for an account. Right > > now it sendshttp://localhost:3000/activation_codenow I want to > > include server ip address instead of localhost > > > On May 22, 12:28 pm, Mahalingam Mr <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > if the server is in windows look for the httpd.conf file in it & edit > the servername from localhost to your servers ip address.. > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks alot Guys for your time and suggestion. Thank you... On May 23, 11:03 am, Gregg Kang <kangarooste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Okay I hate to ask for more details but the server ip address can be > several things. First of all the IP address that your RoR web server > is binding to may not be the correct IP address depending on what you > are trying to do. If you are going to access your web server from your > internal network, then yes the IP address that your RoR web server is > binding to will most likely be the correct one. However, if your web > server is serving requests to the outside (for example, to others on > the internet) you will most likely have a different "server" IP > address that is provided to you by your ISP (this would be your public > IP address). Then you must make sure that you have the appropriate > port mapping rules (eg. firewall rules) that will route port 80 (or > any port like 3000) on the public IP address to your computer''s IP > address''s port 3000 that is running the RoR web server. > > In either case, if you are using apache I would change the > ''servername'' (also suggested by Mahalingam) to the either one of the > two possible IP address I mentioned above, either the local computer''s > internal IP address or the public IP address. > > Thanks, > Gregg > > On May 22, 1:28 am, mrbless <mrbl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > I am using window. My requirement is to send the email with the link > > including activation code when the user sign up for an account. Right > > now it sendshttp://localhost:3000/activation_codenowI want to > > include server ip address instead of localhost > > > On May 22, 12:28 pm, Mahalingam Mr <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > wrote: > > > > Mr. Bless wrote: > > > > How to get the server Ip address dynamically. > > > > what operating system do u use?...do u have a dhcp server in your > > > network? > > > > if you have a dhcp server and your server operating system is linux, > > > then type > > > > dhclient in the terminal...it will fetch you a ip address dynamically... > > > -- > > > Posted viahttp://www.ruby-forum.com/. > > On May 22, 4:02 am, Mahalingam Mr <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > > > mrbless wrote: > > > I am using window. My requirement is to send the email with the link > > > including activation code when the user sign up for an account. Right > > > now it sendshttp://localhost:3000/activation_codenowI want to > > > include server ip address instead of localhost > > > > On May 22, 12:28 pm, Mahalingam Mr <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > > if the server is in windows look for the httpd.conf file in it & edit > > the servername from localhost to your servers ip address.. > > -- > > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
ok On May 22, 11:23 am, Gregg Kang <kangarooste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Can you elaborate on what you are trying to accomplish? > > On May 21, 9:18 pm, "Mr. Bless" <rananirv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > How to get the server Ip address dynamically.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---