Ubuntu 11.10与Nginx和uWSGI

前端之家收集整理的这篇文章主要介绍了Ubuntu 11.10与Nginx和uWSGI前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正试图获得一个LNP [ Linux Nginx Python]堆栈(甚至是一件事?嘿),但我遇到了一些困难.

很多博客文章文件做这似乎是围绕着使用新贵管理uWSGI进程,这将是很好,但我注意到,与脚本init.d中安装的软件包,并在/ etc / uwsgi一些配置目录/ {启用应用程序-,应用程序可用}.显然,有一种更好的方法可以做到这一点.

我有一些配置文件(下面),但我似乎无法启动uwsgi进程,运行init.d脚本什么都不做,报告成功但是无声地失败(甚至没有日志).

当我直接执行uWSGI时,我得到了这个:

% sudo uwsgi -i /etc/uwsgi/apps-enabled/site.ini
tmp = /
[uWSGI] getting INI configuration from /etc/uwsgi/apps-enabled/site.ini

/usr/lib/uwsgi/plugins/python27_plugin.so

另外值得注意的是,当我尝试访问该站点时抛出的错误

% cat logs/error.log 
2012/01/08 23:26:12 [crit] 9167#0: *13 connect() to unix://tmp/site.sock Failed (2: No such file or directory) while connecting to upstream,client: 60.241.99.33,server: mysite.com,request: "GET / HTTP/1.1",upstream: "uwsgi://unix://tmp/site.sock:",host: "mysite.com"

uWSGI配置

% cat /etc/uwsgi/apps-enabled/config.ini 
[uwsgi]
uid = www-data
gid = www-data
home = /srv/www/site/myapp
socket = /tmp/site.sock
pythonpath = /srv/www/site/virtualenvs/default
harakiri = 60
daemonize = /srv/www/site/logs/uwsgi.log
plugins = http,python

Nginx配置

% cat /etc/Nginx/sites-enabled/mysite.com 
server {
    listen 80;
    server_name mysite.com;
    access_log /srv/www/site/logs/access.log;
    error_log /srv/www/site/logs/error.log;
    root   /srv/www/site/public_html;
    index  index.html index.htm;


    location / {
        uwsgi_pass unix:///tmp/site.sock;
        include uwsgi_params;
    }

    location ~ /\. {
        access_log off;
        log_not_found off; 
        deny all;
    }

    location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)${
        access_log        off;
        log_not_found     off;
        expires           360d;
    }
}

我正在使用

% dpkg --get-selections | grep uwsgi
libapache2-mod-uwsgi        install
uwsgi                       install
uwsgi-core                  install
uwsgi-plugin-http           install
uwsgi-plugin-python         install
% dpkg --get-selections | grep Nginx
Nginx-common                install
Nginx-extras                install
Nginx-full                  deinstall

一些版本信息

% Nginx -V                                                                                                                       
Nginx: Nginx version: Nginx/1.0.5
Nginx: TLS SNI support enabled
Nginx: configure arguments: --prefix=/etc/Nginx --conf-path=/etc/Nginx/Nginx.conf --error-log-path=/var/log/Nginx/error.log --http-client-body-temp-path=/var/lib/Nginx/body --http-fastcgi-temp-path=/var/lib/Nginx/fastcgi --http-log-path=/var/log/Nginx/access.log --http-proxy-temp-path=/var/lib/Nginx/proxy --http-scgi-temp-path=/var/lib/Nginx/scgi --http-uwsgi-temp-path=/var/lib/Nginx/uwsgi --lock-path=/var/lock/Nginx.lock --pid-path=/var/run/Nginx.pid --with-debug --with-http_addition_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_perl_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module --add-module=/build/buildd/Nginx-1.0.5/debian/modules/Nginx-development-kit --add-module=/build/buildd/Nginx-1.0.5/debian/modules/Nginx-upstream-fair --add-module=/build/buildd/Nginx-1.0.5/debian/modules/Nginx-echo --add-module=/build/buildd/Nginx-1.0.5/debian/modules/Nginx-lua --add-module=/build/buildd/Nginx-1.0.5/debian/modules/Nginx-http-push --add-module=/build/buildd/Nginx-1.0.5/debian/modules/Nginx-upload-progress --add-module=/build/buildd/Nginx-1.0.5/debian/modules/Nginx-secure-download
% uwsgi --version
uWSGI 0.9.8.1-debian
您使用/srv/www/site/logs/uwsgi.log作为日志守护uwsgi app服务器. uwsgi日志应包含有关无法首先创建sock文件的原因的信息.
原文链接:https://www.f2er.com/ubuntu/348118.html

猜你在找的Ubuntu相关文章