Which begs the question.. how does one set up multiple virtual hosts on a single machine/vm where different domain names forward to different pyramid instances?
Michael Hanna On Sat, Nov 2, 2013 at 2:53 AM, Mazzaroth M. <taomaili...@gmail.com> wrote: > I should also mention that simply pointing a web browser at > http://localhost served up the pyramid app. > > > > On Sat, Nov 2, 2013 at 2:52 AM, Mazzaroth M. <taomaili...@gmail.com>wrote: > >> I figured it out. For posterity, I needed to use the gunicorn --bind >> argument. The final line that worked for me: >> >> ../bin/gunicorn --paster production.ini --bind unix:app.sock >> >> hope this helps someone down the line. >> >> >> On Sat, Nov 2, 2013 at 1:15 AM, Mazzaroth M. <taomaili...@gmail.com>wrote: >> >>> I have confirmed that I am running my pyramid app with gunicorn. In my >>> virtualenv: >>> >>> ../bin/gunicorn --paster production.ini >>> >>> So, my next step, I'd like to set up nginx as a reverse-proxy to >>> gunicorn. >>> >>> This is what I've done so far: >>> >>> ***in production.ini: >>> >>> [server:main] >>> use = egg:waitress#main >>> host = 0.0.0.0 >>> port = 6543 >>> unix_socket = %(here)s/app.sock >>> >>> ***in nginx.conf: >>> >>> http { >>> ... >>> >>> upstream foo-site { >>> server >>> unix:///Users/michael/src/pyr/initpyr/foo_env/foo/app.sock fail_timeout=0; >>> } >>> >>> I also tried server http://127.0.0.1:6543 fail_timeout=0; but >>> nginx -t would complain ` invalid host in upstream " >>> http://127.0.0.1:6543" ` >>> >>> server { >>> listen 80 default; >>> server_name _; >>> access_log >>> /Users/michael/src/pyr/initpyr/foo_env/foo/access.log; >>> >>> location / { >>> proxy_set_header Host $http_host; >>> proxy_set_header X-Real-IP $remote_addr; >>> proxy_set_header X-Forwarded-For >>> $proxy_add_x_forwarded_for; >>> proxy_set_header X-Forwarded-Proto $scheme; >>> >>> client_max_body_size 10m; >>> client_body_buffer_size 128k; >>> proxy_connect_timeout 60s; >>> proxy_send_timeout 90s; >>> proxy_read_timeout 90s; >>> proxy_buffering off; >>> proxy_temp_file_write_size 64k; >>> proxy_pass http://foo-site; >>> proxy_redirect off; >>> } >>> } >>> >>> >>> I installed nginx via homebrew, so when I do >>> sudo launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist >>> >>> and open a web browser to: >>> http://localhost >>> >>> I get 502 Gateway >>> >>> ***in the nginx error log: >>> >>> 2013/11/02 01:05:52 [crit] 6851#0: *1 connect() to >>> *unix:///Users/michael/src/pyr/initpyr/foo_env/foo/app.sock* failed (2: *No >>> such file or directory*) while connecting to upstream, client: >>> 127.0.0.1, server: _, request: "GET / HTTP/1.1", upstream: >>> "http://unix:///Users/michael/src/pyr/initpyr/foo_env/foo/app.sock:/", >>> host: "localhost" >>> >>> I checked and yes, the file is not there. But I specified it in the >>> production.ini file. I assumed gunicorn would generate this socket. How do >>> I generate this socket so that nginx can connect to the gunicorn-pyramid >>> app? >>> >>> here are some urls that helped me along the way: >>> http://discuss.textdrive.com/viewtopic.php?id=647 >>> http://docs.gunicorn.org/en/latest/deploy.html >>> >>> http://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest/deployment/nginx.html >>> >>> I know I'm pretty close and hope some suggestions could be made.. >>> >>> regards, >>> Michael Hanna >>> >>> >> > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discuss+unsubscr...@googlegroups.com. To post to this group, send email to pylons-discuss@googlegroups.com. Visit this group at http://groups.google.com/group/pylons-discuss. For more options, visit https://groups.google.com/groups/opt_out.