diff mbox

lib: Refresh nginx/uwsgi configuration

Message ID 1473194223-20497-1-git-send-email-thomas.monjalon@6wind.com
State Accepted
Headers show

Commit Message

Thomas Monjalon Sept. 6, 2016, 8:37 p.m. UTC
As stated in http://uwsgi-docs.readthedocs.io/en/latest/Nginx.html:
"
Unfortunately nginx is not able to rewrite PATH_INFO accordingly to
SCRIPT_NAME. For such reason you need to instruct uWSGI to map specific
apps in the so called “mountpoint” and rewrite SCRIPT_NAME and PATH_INFO
automatically
[...]
ancient uWSGI versions used to support the so called “uwsgi_modifier1 30”
approach. Do not do it. it is a really ugly hack
"

Replacing the uwsgi_modifier1 hack by a mount point seems to work.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 lib/nginx/patchwork.conf | 1 -
 lib/uwsgi/patchwork.ini  | 5 +++++
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Stephen Finucane Sept. 7, 2016, 8:03 p.m. UTC | #1
On 06 Sep 22:37, Thomas Monjalon wrote:
> As stated in http://uwsgi-docs.readthedocs.io/en/latest/Nginx.html:
> "
> Unfortunately nginx is not able to rewrite PATH_INFO accordingly to
> SCRIPT_NAME. For such reason you need to instruct uWSGI to map specific
> apps in the so called “mountpoint” and rewrite SCRIPT_NAME and PATH_INFO
> automatically
> [...]
> ancient uWSGI versions used to support the so called “uwsgi_modifier1 30”
> approach. Do not do it. it is a really ugly hack
> "
> 
> Replacing the uwsgi_modifier1 hack by a mount point seems to work.
> 
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>

I don't know enough about nginx to say yay or nay, but it makes sense
per the linked article and works on dpdk.org, so:

Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>

...and merged.

Cheers :)

Stephen
diff mbox

Patch

diff --git a/lib/nginx/patchwork.conf b/lib/nginx/patchwork.conf
index 5479496..1e69d1a 100644
--- a/lib/nginx/patchwork.conf
+++ b/lib/nginx/patchwork.conf
@@ -35,7 +35,6 @@  http {
         location / {
             include uwsgi_params;
             uwsgi_pass unix:/run/uwsgi/patchwork.sock;
-            uwsgi_modifier1 30;
         }
     }
 }
diff --git a/lib/uwsgi/patchwork.ini b/lib/uwsgi/patchwork.ini
index fc0f0ed..04a9837 100644
--- a/lib/uwsgi/patchwork.ini
+++ b/lib/uwsgi/patchwork.ini
@@ -6,11 +6,16 @@  project = patchwork
 base = /opt
 user = www-data
 group = www-data
+url = /
 
 chdir = %(base)/%(project)
 pythonpath = %(base)/%(project)
 module = %(project).wsgi:application
 
+# rewrite PATH_INFO and SCRIPT_NAME according to mount-points (for nginx)
+manage-script-name = true
+mount = %(url)=%(module)
+
 master = true
 processes = 5
 # increase buffer size to avoid "502 bad gateway error"