Using Python scripts to deploy MoinMoin on Nginx and uwsgi, uwsgimoinmoin
MoinMoin is deployed using apache + mod_wsgi in CentOS, but the editing and saving pages are slow. Therefore, you are ready to redeploy the MoinMoin using nginx + uwsgi.
This document assumes that Quick MoinMoin on CentOS has completed basic installation beyond apache and mod_wsgi following official instructions.
Install Nginx
By default, CentOS without nginx source, you need to manually add, access the http://nginx.org/en/linux_packages.html#stable to download CentOS 6 rpm package, and install
wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpmrpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm
Run the following command to install nginx:
Yum install nginx
Install uwsgi
Install python package management tool pip
yum install python-devel python-setuptoolswget https://raw.github.com/pypa/pip/master/contrib/get-pip.py -O - | python
Install uwsgi using pip (using the image of Douban)
pip install -v uwsgi -i http://pypi.douban.com/simple
Start moin with uwsgi
Create uwsgi configuration/etc/uwsgi. xml as follows
<uwsgi><socket>/var/run/moin.sock</socket> <chmod-socket>666</chmod-socket><limit-as>256</limit-as><processes>6</processes><memory-report/><vhost/><no-site/></uwsgi>
<Chmod-socket> 666 </chmod-socket> indicates that nginx has no permission to access moin. sock.
Rename the moin wsgi STARTUP script to be recognized by uwsgi.
cd /usr/local/share/moinmv moin.wsgi moin_wsgi.py
To start uwsgi, run the following command:
uwsgi -x /etc/uwsgi/uwsgi.xml
Configure nginx to access uwsgi
Create/etc/nginx/conf. d/moin. conf as follows:
# Moinmoin VM configuration server {listen YOUR_SERVER_IP: 80; server_name localhost; access_log/var/log/nginx/moin. access_log main; error_log/var/log/nginx/moin. error_log info; location ^ ~ /{Include uwsgi_params; uwsgi_pass unix: // var/run/moin. sock; # export UWSGI_PYHOME/usr/local/lib/python2.6/; # site-packages/; export UWSGI_CHDIR/usr/local/share/moin/; uwsgi_param UWSGI_SCRIPT moin_wsgi; uwsgi_param SCRIPT_NAME/; uwsgi_modifier1 30;} location ^ ~ /Moin_static193/{alias/usr/local/lib/python2.6/site-packages/MoinMoin/web/static/htdocs/; add_header Cache-Control public; expires 1 M ;}}
Run nginx
nginx
Operation and troubleshooting
Next, you can access the Wiki through a browser. However, you find that editing and saving pages are still slow. Then, after a little Google, you will find an article to solve this problem and quickly solve the problem.
Edit wikiconfig. py and add the following Configuration:
Log_reverse_dns_lookups = False
Restart uwsgi and access Wiki again. The slow problem is solved. (why didn't I find this article before !)