Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This is a very basic question. I'm running a VPS, and I can run web apps on the server to any local ip/port as I choose. How do I actually get these local ips/ports mapped to live domains registered on the server to make my site accessible?

It's a ruby on rails application, running on a cPanel VPS. I'm starting the ruby on rails server simply by typing rails server, using the simple default WEBrick server ( I don't need anything more complex right now ). By default the app starts on port 3000, but I can customize that to any port I want.

(NOTE: cPanel does not support Rails 3 because mongrel has issues with it. I am not using mongrel, just the default WEBrick server, so this should not be an issue. )

share|improve this question
    
what you meant by local Ip.? You don't have public IP assigned to your server ? –  SparX Oct 3 '11 at 20:26
    
I'm running an application, and it starts the application on 0.0.0.0:3000. I just need to host that on a real domain now –  Ankit Soni Oct 3 '11 at 22:01
2  
well, 0.0.0.0 means all interfaces and you can simply access the application using your-public-ip:3000 –  SparX Oct 3 '11 at 22:18
    
@SparX OK, thanks. Now, how can I host the web app on a specific URL on the server only? (since the server hosts multiple apps on multiple domains) –  Ankit Soni Oct 3 '11 at 22:29
    
What kind of application you are trying to deploy? Please add more details in your question. Normally, you can point the domain to your server IP and then can use ProxyPass in apache conf to redirect the traffic to that domain to your internal app running in 0.0.0.0:3000 –  SparX Oct 3 '11 at 23:16
show 1 more comment

1 Answer

What you need to do is,

  1. Create the domain through WHM
  2. Start your web application on the desired port(eg: 3000) and bind to localhost (since public access via port 3000 is not necessary).
  3. Setup ProxyPass and ProxyPassReverse in apache conf or in your .htaccess file (normally /home/username/public_html/.htaccess in cpanel)

ProxyPass / http://127.0.0.1:3000/

ProxyPassReverse / http://127.0.0.1:3000/

Now all the requests to domain.com will be forwarded to your rails app running on port 3000 and vice versa.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.