Giorga
By:
Giorga

How do I forward domain to open rails ip:port page?

May 23, 2015 1.8k views
DNS Ruby on Rails Nginx

Hello, I am just messing around with Ruby on the Rails, so I've installed simple app to learn from it, however it runs on domain:3000 port

How do I change it to open on just domain.com ?

thanks

2 Answers

Install a webserver and forward requests to port 3000.

Yeah, I have nginx, how do I forward it to 3000?

  • That is easy:

    ```sudo nano /etc/nginx/conf.d/virtual.conf

    Change it to :
    
    
    A virtual host using mix of IP-, name-, and port-based configuration

    server {
    listen 80;

    listen *:80;
    server_name  DOMAIN.COM;
    
    location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;
        proxy_pass         http://127.0.0.1:PORT;
    }
    

    }

    Save and :
    
    ```sudo service nginx restart
    
Have another answer? Share your knowledge.