nginx config: different projects in different directories

Ruben LZ Tan soggie at gmail.com
Mon Oct 7 05:39:33 UTC 2013


Maybe try setting location /hello and /world would help?

Thanks,
Ruben Tan


On Monday, October 7, 2013 at 1:27 PM, Jabba Laci wrote:

> Hi,
> 
> I'm new to the list. I started to learn the Python web framework Flask
> and I would like to try it in production environment too. I managed to
> bring Flask together with uwsgi and nginx. My Flask application is
> available at the address localhost:81 .
> 
> I would like to add several applications and I want them to be
> available under different URLs. For instance, if I have two projects
> called "hello" and "world", I want to access them as
> localhost:81/hello/ and localhost:81/world/ . The problem is I can't
> figure out how to configure nginx for this.
> 
> Here is my current setup:
> 
> * The project "hello" is in this directory: /home/jabba/public_pyapps/hello/
> * Its nginx entry:
> 
> server {
> listen 81;
> server_name localhost;
> charset utf-8;
> client_max_body_size 75M;
> 
> location / { try_files $uri @yourapplication; }
> location @yourapplication {
> include uwsgi_params;
> uwsgi_pass unix:/home/jabba/public_pyapps/hello/hello_uwsgi.sock;
> }
> }
> 
> It's available at localhost:81 .
> 
> Questions:
> 
> (1) How to make it available under localhost:81/hello/ instead?
> 
> (2) If I add a new application (e.g. "world") next to previous ones,
> how to add it to nginx?
> 
> Thanks,
> 
> Laszlo
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org (mailto:nginx at nginx.org)
> http://mailman.nginx.org/mailman/listinfo/nginx
> 
> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20131007/7bd14199/attachment.html>


More information about the nginx mailing list