quixote app with nginx fastcgi redirect problem

quixote app with nginx fastcgi redirect problem

if you want to run quixote app with nginx fastcgi
you need patch the publish.py file

search with "request.get_environ('PATH_INFO', '')"
then add below code after that code
if 'nginx' in request.get_environ('SERVER_SOFTWARE', '') and request.get_environ('PATH_INFO', '') == '':
    path = request.get_environ('SCRIPT_NAME', '')
else:
    path = request.get_environ('PATH_INFO', '') << this is original code


there is another way if you don't want change lib come from quixote
just rewrite function try_publish in you own publisher

change 
path = request.get_environ('PATH_INFO', '')
to
path = request.get_environ('SCRIPT_NAME', '')


that code will fix quxiote redirect problem with nginx

the definition of SCRIPT_NAME and PATH_INFO
REQUEST_URI              SCRIPT_NAME        PATH_INFO
------------------------+------------------+-------------
/scripts/blog.rb/        /scripts/blog.rb   /
/scripts/blog.rb/add     /scripts/blog.rb   /add
/scripts/blog.rb/view/1  /scripts/blog.rb   /view/1

你可能感兴趣的:(nginx,python,Blog)