Tuesday 15 February 2011

nginx + passenger + rails: do I need to start the rails server or just start nginx? -


I am trying to listen to my rail server on two separate ports. One solution was proposed for me using nginx I have installed nginx with the sudo-passenger-install-nginx-module and the following is included in /etc/nginx/conf.d :

  server {80; Listen to 10000; Server_name at www.myapp.com; passenger_enabled; Root / myapp / public;}   

When I went to www.myapp.com, I found a 403 forbidden error, I thought it was because there was no static HTML files / public I did not leave a simple "Hello World" HTL page and loaded it correctly. I then started my rail app using the passenger start-e production , which used to run it in standalone fusion passenger mode on port 3000. I am going to myapp.com.3000 and I'm getting the app. However, myapp: 80 and myapp: 10000 still do not work. I am skeptical about how to get your nginx to point to the rail server I am running. Am I doing this completely wrong? Thanks!

Set nginx to forward to my rail server using this on

  employee_process1; Error_log /usr/local/var/log/nginx.error.log; Event {worker_connections 1024; } Http {include mime.types; Default_type application / octet-stream; Send file on; Keepalive_timeout 65; Upstream dev {server 127.0.0.1:3000; } Server {80; # You can enter server_name here (or multiple) server_name if # * you have not setup wildcard DNS for * .dev domain # see http://jessedearing.com/nodes/9-setting-up-wildcard-subdomains- On-os -x-10-6 # If we choose a root, then we can not easily switch things # # Dev / tap means that static assets are served instead of #r rail, which OK for development / dev / null; Index index.html index.htm; Try_files $ uri / index.html $ uri.html $ ur @dev; Location @dev {proxy_set_header X-real-IP $ remote_addr; Proxy_set_header X-Forward- $ proxy_add_x_forwarded_for; Proxy_set_header host $ http_host; Proxy_redirect closed; Proxy_pass http: // dev; } Error_page 500 502 503 504 / 50x.html; }}    

No comments:

Post a Comment