все,заголовки отсутствуют в ответ HTTP с Nginx + uWsgi + web.py
Мой Evironment является Nginx + uWsgi + Web.py. И я получил следующий ответ HTTP:
Connection keep-alive
Date Mon, 28 Oct 2013 09:02:50 GMT
Server nginx
Transfer-Encoding chunked
Однако, ответ должен быть, как это производится Apache + mod_wsgi:
Connection Keep-Alive
Content-Encoding gzip
Content-Length 26225
Content-Type text/html; charset=UTF-8
Date Mon, 28 Oct 2013 08:08:33 GMT
Keep-Alive timeout=15, max=100
Server Apache
Vary *
Итак, есть много заголовка отсутствует. Не могу понять ....
Мой Nginx конфигурации, как:
http {
charset utf-8;
# Set the mime-types via the mime.types external file
include mime.types;
# And the fallback mime-type
default_type application/octet-stream;
#default_type text/html;
# Click tracking!
access_log /var/log/nginx/access.log;
# Hide nginx version
server_tokens off;
# ~2 seconds is often enough for HTML/CSS, but connections in
# Nginx are cheap, so generally it's safe to increase it
keepalive_timeout 20;
# You usually want to serve static files with Nginx
sendfile on;
tcp_nopush on; # off may be better for Comet/long-poll stuff
tcp_nodelay off; # on may be better for Comet/long-poll stuff
server_name_in_redirect off;
types_hash_max_size 2048;
gzip on;
gzip_http_version 1.0;
gzip_comp_level 5;
gzip_min_length 512;
gzip_buffers 4 8k;
gzip_proxied any;
gzip_types
# text/html is always compressed by HttpGzipModule
text/css
text/plain
text/x-component
application/javascript
application/json
application/xml
application/xhtml+xml
application/x-font-ttf
application/x-font-opentype
application/vnd.ms-fontobject
image/svg+xml
image/x-icon;
# This should be turned on if you are going to have pre-compressed copies (.gz) of
# static files available. If not it should be left off as it will cause extra I/O
# for the check. It would be better to enable this in a location {} block for
# a specific directory:
# gzip_static on;
gzip_disable "msie6";
gzip_vary on;
# Upstream to abstract backend connection(s) for PHP
upstream php {
server unix:/run/php-fpm/php-fpm.sock;
}
server {
## listen for ipv4; this line is default and implied
listen 80 default;
## listen for ipv6
#listen [::]:80 default ipv6only=on;
# Make site accessible from http://localhost/
server_name localhost;
server_name_in_redirect off;
charset utf-8;
access_log /log/access.log;
error_log /log/error.log debug;
root /home/www;
index index.html index.htm index.php;
location ~ \.php$ { .... }
location/{
uwsgi_pass unix:/tmp/uwsgi.sock;
include uwsgi_params;
}
}
И мой uWsgi конфигурации является:
[uwsgi]
plugins = python2
chdir = /home/pycode
module = code
processes = 2
max-requests = 5000
chmod-socket = 666
master = True
vacuum = True
disable-logging = True
enable-threads = True
socket = /tmp/uwsgi.sock
pidfile = /run/uwsgi.pid
workers = 4
reload-mercy = 8
uid = http
gid = http
код питона над web.py использует шаблон jinja2 без каких-либо специальных и хорошо работать в Apache + mod_wsgi.
Кстати, nginx + php-fpm дает правильный ответ в моем случае. Поэтому я предполагаю, что проблема связана с конфигурацией uwsgi.
Любая помощь?
Спасибо в противовес.
Непонятно, работает ли приложение, или вы просто хотите сжатие gzip (что-то не происходит из вложенных журналов) – roberto