Hot answers tagged

24

I prefer uwsgi because it's super configurable and has tons of options. From the benchmarks I've done it has the best performance/memory usage. It's very flexible and can probably be configured precisely to suit your needs. I use uwsgi's emperor mode to host multiple apps. It will scan a given directory for config files and launch/manage all applications it ...


20

For newer versions of apache you might need this. <Directory /opt/graphite/conf> #Order deny,allow #Allow from all Options All AllowOverride All Require all granted </Directory>


10

unable to find "application" callable in file /var/www/coefficient/flask.py is the key :) Your app is defining an 'app' callable, so you have to instruct uWSGI to search for it, instead of 'application'. You can use the option callable: app and it will works (this is explained in official Flask docs)


9

I would suggest the use of supervisord. In my experience, it is friendlier and generally a smoother experience than runit or the venerable daemontools. Upstart is designed to replace the equally-venerable init process, while supervisord is specifically for managing things like WSGI, FastCGI, and the like. It is also pretty well-documented. Because it is ...


8

yum install mod_wsgi confirmed on CentOS 5.7


7

Add to nginx location: fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name;


6

Because nginx is an event driven system, it is in effect single threaded at lowest level. In other words, not much different to prefork MPM when using Apache. This means that once a request is being handled in the WSGI application running under nginx/mod_wsgi, no parallel tasks can be carried out. In prefork MPM of Apache this isn't too serious an issue ...


6

Use WSGIRestrictStdout option: WSGIRestrictStdout Off or replace sys.stdout with sys.stderr in Django WSGI star script: import sys sys.stdout = sys.stderr Writing To Standard Output No WSGI application component which claims to be portable should write to standard output. That is, an application should not use the Python print statement without ...


5

Your mod_wsgi was compiled for Python 2.7. You cannot then try and point it at a Python 2.5 virtual environment. Also, the setting: WSGIPythonHome /home/rory/tix/virtualenv2.5/lib/python2.5/ is pointing at the wrong thing even if it was a Python 2.7 virtual environment. The settings: UnSetEnv PYTHONSTARTUP SetEnv PYTHONPATH ...


5

you would run your python server on a different port, then make use of Apache's (or any decent webserver like nginx etc) reverse proxy functionality to reverse proxy any requests for example/com/reallycoolpythonwebapp to the python app server this will also appear transparent to the user as well some apache config within the example.com vhost might look ...


5

Take a look in /proc/<PID>/fd which should list all of the open files that PID has open. On my CentOS system fd 7 is lrwx------. 1 root root 64 Aug 28 22:01 7 -> socket:[1872522] I can then use netstat -ane | grep 1872522 to get tcp 0 0 :::443 :::* LISTEN 0 1872522 You can use lsof | grep ...


3

Use method described in: http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#The_Apache_Alias_Directive Thus have DocumentRoot setup as normal for static files and php files etc. Then add: AddHandler wsgi-script .wsgi to Directory block for DocumentRoot, or globally for server. You will though need to have: Options ExecCGI enabled for ...


3

You are reading it wrong. Apache does start as 'root' and the parent Apache process stays as 'root', only the Apache server child process run as 'www-data'. The mod_wsgi daemon processes are forked from the parent 'root' process and so will still be able to change to that user. What the comment is saying is that if you start Apache from a totally non ...


3

you can use a decorator on your views to make them only avail from ssl. @secure_required @login_required def edit_member(request, slug): ... http://www.redrobotstudios.com/blog/2009/02/18/securing-django-with-ssl/


3

You didn't asked for a specific version of ISPConfig so I'll assume you are using ISPConfig 3. I didn't tried that by myself, but I've found here a step-by-step instructions on how to install ispconfig3 + django + mod_wsgi - Django and mod_wsgi | HowToForge Forums If somethings goes wrong you could try reply to the mentioned thread or start a new thread ...


3

I got it working! Here's what I did: Created /etc/uwsgi/apps-available/myapp.xml: <uwsgi> <socket>/tmp/uwsgi-myapp.sock</socket> <plugins>http, python</plugins> <chdir>/path/to/directory/containing/python/app</chdir> <module>myapp</module><!-- myapp.py from before --> ...


3

Both Pyramid and Nginx have very good documentation, independently. I assume you've built your site locally with Waitress or Paster serving the content. Essentially, from within Nginx's config, you are just going to direct incoming traffic from port 80 (the usual port for website traffic) to your Paster/Waitress port (e.g. 8000, 6543, etc.). There are some ...


3

Looking at my little VPS, I can determine the fd number the following way: ll /proc/17684/fd/ |colrm 1 46 0 -> /dev/null 1 -> /dev/null 10 -> /var/www/vhosts/censored.xenuser.org/statistics/logs/error_log 11 -> /var/www/vhosts/censored.de/statistics/logs/error_log 12 -> /var/www/vhosts/censored.org/statistics/logs/error_log 13 -> ...


3

I was able to get around this issue by editing /proc/sys/net/core/somaxconn from 128 to 20000. This allows larger bursts of traffic. I may not have needed to set it so high, but this application can burst very high. I am also using gunicorn & nginx.


3

ScriptAlias is for cgi-script handler in Apache. WSGIScriptAlias is equivalent for wsgi-script. If you want to mix them in the same directory, don't use either, use Alias, Options ExecCGI, AddHandler directives instead. See: http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#The_Apache_Alias_Directive


3

the --app option is deprecated by more than a year (it should be reported in uWSGI logs if you use a stable version 1.2/1.4). For wsgi apps you use --module (for python modules) and --wsgi-file (for .wsgi files)


3

you have more config-options with a full-blown reverse - proxy like rewrite locations server https header-cleanup expires gzip .... you can do loadbalancing you can use proxy_cache you can implement custom error-pages, even when your app-servers are down you can have a WAF implemented you can (sometimes) hotpatch against vulnerabilities BONUSPOINT ...


3

Presuming you are not using a very old obsolete mod_wsgi version, you can say: WSGIDaemonProcess prod-instance WSGIScriptAlias /prod-instance /opt/wsgi_applications/prod/app.wsgi process-group=prod-instance application-group=%{GLOBAL} WSGIDaemonProcess test-instance WSGIScriptAlias /test-instance /opt/wsgi_applications/test/app.wsgi ...


3

It would be loaded once per process. You likely are using a multiprocess configuration and subsequent requests are being handled by different process and/or processes are being recycled. Print out the process ID in the debug. Also go read: http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading ...


2

The main benefit of using Nginx as your web server is the smaller memory footprint compared to Apache, essential when you're running a resource constrained VPS. Regarding the WSGI recommendation, you have a lot of good options, uWSGI and Gunicorn being two of them. I've tried both but I ended up using FAPWS3 instead because of the more strait forward setup ...


2

add --limit-as option to each instance and limit the number of requests each process will manage after being restarted (-R 1000 is normally a good value, this will mitigate leaks) 30 processes per app looks a bit too much for me, start with 8 (ncpu*2) and increase them if you need it If you want, you can use the development tree (take it via mercurial) and ...


2

It should go outside of any VirtualHost directives. See: http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIPythonHome Per definitions at: http://httpd.apache.org/docs/2.2/mod/directive-dict.html#Context and linked from context label for the entry, the value 'server config' means: """This means that the directive may be used in the server ...


2

Shouldn't you have issued restart as an argument to your init script? I would expect sudo /etc/init.d/nginx start to complain if nginx was already running. Which it sounds like it was.


2

you should ask it in the official mailing-list, all of your statements are true, so you should try to ask for an improvement in the list.


2

I finally figured out how to solve this. First of I trouble upgrading ubuntu to 10.10 from 10.04 because the server only offered 128mb (256mb burstable) and ran out mid upgrade. Maybe the solution to this issue is to simply upgrade ubuntu. I did however upgrade mod-wsgi by installing it from source as described here, but that didn't seem to affect anything. ...



Only top voted, non community-wiki answers of a minimum length are eligible