Question

I'm running a small Rails project using a production server from Linode. I would love to test some features in staging but I can't justify purchasing another server from Linode to perfectly mimic my production.

I currently have two directories setup: live and staging. The site is running from the copy of the app in the "live" folder. When I go into the "staging" folder and run "rails s," WEBrick launches onto port 3000. Is there any way to access this staging server from the outside? I've tried http://wwww.my-ip:3000 but no luck.

Essentially, is there a way to temporarily run my staging app on a different port of my production server without affecting the live website?

Thanks, Michael Boutros

Était-ce utile?

La solution

You can make the webserver listen on two different ports. One will be your default port(80)

server {
        listen       3000;
        server_name  localhost; #server_name _; if you want this vh for all projects in your /var/www/ folder.
        root /var/www/project1; # If you want this config for specific project, or else keep it /var/www for all the projects in the www/ folder
    index index.php index.html index.htm;
}

set the root to your staging location and you should be able to access it like http://www.my-ip:3000

Have a look at this post. It will give you an idea even if you are not using nginx

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top