On 02/11/2011 17:53, Roberto De Ioris wrote:
You should rebuild uWSGI with debug enabled (set debug = true in
buildconf/default.ini and re-run make) and post the whole uWSGI log.
In this way we can see the whole set of variables passed by nginx.
Take in account that adding --no-site will disable all of the installed
modules in python site-packages, so try removing it too.
Hi Roberto,
Thanks again for your reply. I've set debug = true in default.ini and
recompiled. Also the --no-site switch has been removed from the start-up
flags.
My configuration now looks like this:
--- nginx.conf begins ---
server {
listen 443;
server_name hg.domain.com;
location / {
uwsgi_pass unix:/tmp/uwsgi.sock;
uwsgi_param UWSGI_SCRIPT hgweb_wsgi;
uwsgi_param UWSGI_CHDIR /usr/local/www/vhosts/hg.domain.com;
include uwsgi_params;
}
location /static {
alias
/usr/local/lib/python2.7/site-packages/mercurial/templates/static;
}
[snip ssl config]
}
--- end of nginx.conf ---
The uwsgi flags are set to: uwsgi_flags="-M -L --vhost"
When I try to access the main Mercurial page, the log shows:
[uWSGI DEBUG] uwsgi payload size: 731 (0x2DB) modifier1: 0 modifier2: 0
[uWSGI DEBUG] PATH_INFO=/
[uWSGI DEBUG] SERVER_NAME=hg.domain.com
[uWSGI DEBUG] VirtualHost KEY=hg.domain.com|
searching for hg.domain.com| in hg.domain.com|/hgweb_wsgi 0x801742ed0
searching for hg.domain.com| in hg.domain.com| 0x8031109d0
[uWSGI DEBUG] chdir to /usr/local/www/vhosts/hg.domain.com
[uWSGI DEBUG] UWSGI_SCRIPT: hgweb_wsgi
[uWSGI DEBUG] UWSGI_CHDIR: /usr/local/www/vhosts/hg.domain.com
[uWSGI DEBUG] QUERY_STRING:
[uWSGI DEBUG] REQUEST_METHOD: GET
[uWSGI DEBUG] CONTENT_TYPE:
[uWSGI DEBUG] CONTENT_LENGTH:
[uWSGI DEBUG] REQUEST_URI: /
[uWSGI DEBUG] PATH_INFO: /
[uWSGI DEBUG] DOCUMENT_ROOT: /usr/local/etc/nginx/html
[uWSGI DEBUG] SERVER_PROTOCOL: HTTP/1.1
[uWSGI DEBUG] REMOTE_ADDR: xxx.xxx.22.145
[uWSGI DEBUG] REMOTE_PORT: 53633
[uWSGI DEBUG] SERVER_PORT: 443
[uWSGI DEBUG] SERVER_NAME: hg.domain.com
[uWSGI DEBUG] HTTP_HOST: hg.domain.com
[uWSGI DEBUG] HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 6.1; WOW64;
rv:6.0) Gecko/20100101 Firefox/6.0
[uWSGI DEBUG] HTTP_ACCEPT:
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
[uWSGI DEBUG] HTTP_ACCEPT_LANGUAGE: en-gb,en;q=0.5
[uWSGI DEBUG] HTTP_ACCEPT_ENCODING: gzip, deflate
[uWSGI DEBUG] HTTP_ACCEPT_CHARSET: ISO-8859-1,utf-8;q=0.7,*;q=0.7
[uWSGI DEBUG] HTTP_CONNECTION: keep-alive
[uWSGI DEBUG] HTTP_CACHE_CONTROL: max-age=0
[uWSGI DEBUG] called 0x8031109d0 0x803179a70 1
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/mercurial/util.py", line
251, in increasingchunks
for chunk in source:
File "/usr/local/lib/python2.7/site-packages/mercurial/templater.py",
line 214, in _flatten
for j in _flatten(i):
File "/usr/local/lib/python2.7/site-packages/mercurial/templater.py",
line 207, in _flatten
for i in thing:
File "/usr/local/lib/python2.7/site-packages/mercurial/templater.py",
line 161, in runmap
for i in d:
File
"/usr/local/lib/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.py", line
288, in entries
for row, parity in zip(rows, paritygen(self.stripecount)):
File
"/usr/local/lib/python2.7/site-packages/mercurial/hgweb/hgwebdir_mod.py", line
247, in rawentries
if req.env['SCRIPT_NAME']:
KeyError: 'SCRIPT_NAME'
And a black page is shown in my web browser.
If I then add these to the nginx.conf block:
uwsgi_param SCRIPT_NAME /hgweb_wsgi;
uwsgi_modifier1 30;
It mostly works, and I see the list of Mercurial repositories. However,
all the URLs appear to have the SCRIPT_NAME inserted into them and look
strange.
For example, instead of:
https://hg.domain.com/repository_name/
The URLs appear as:
https://hg.domain.com/hgweb_wsgi/repository_name/
The example (http://projects.unbit.it/uwsgi/wiki/VirtualHosting) I
followed does not use the SCRIPT_NAME parameter, so I'm confused as to
why it complains about that.
Also, as I understand it, hgweb_wsgi (aka hgweb_wsgi.py) is just the
entry point used by the interpreter to launch the app. I don't
understand why it causes hgweb_wsgi to appear in the URL?
With thanks,
mog
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi