Server block with python redirect and url rewrites
-
server {
-
listen 80;
-
server_name localhost; ##ignored if there is only one server block
-
charset utf-8;
-
client_max_body_size 75M;
-
-
#location = /frontend/webfrontendConnectionData {
-
# try_files $uri @yourapplication;
-
#}
-
location /public/web/frontend {
-
alias /frontend/;
-
autoindex off;
-
}
-
# try_files _ @xxx means don't look at any file go to xxx block
-
-
#Turn around /public/api to /api/public because Python has to be one way and kong the other
-
location /public/api {
-
rewrite ^/public/api(.*)$ /api/public/api$1? break;
-
try_files _ @yourapplication;
-
}
-
location /authed/api {
-
rewrite ^/authed/api(.*)$ /api/authed/api$1? break;
-
try_files _ @yourapplication;
-
}
-
#This redirect didn't work. The location seems to select but:
-
#got an nginx 404 Dosen't work with or without trailing slash on alias
-
#location /public/web/apidocs/swaggerui/bower/swagger-ui/dist {
-
# alias /usr/lib/python3.6/site-packages/baseapp_for_restapi_backend_with_swagger/static/;
-
# autoindex off;
-
#}
-
location /public/web/apidocs {
-
rewrite ^/public/web(/apidocs.*)$ /$1? break;
-
try_files $1 @yourapplication;
-
}
-
#location / {
-
# try_files _ @yourapplication;
-
#}
-
location @yourapplication {
-
include uwsgi_params;
-
uwsgi_pass unix:/app/uwsgi.sock;
-
}
-
}
RJM Article Type
Work Notes