This article introduces a tutorial on using Python scripts to deploy MoinMoin on Nginx and Uwsgi, with examples based on the CentOS operating system, and the friends you need can refer to the
The MoinMoin was deployed under CentOS, but the edit and save pages were slow, so they were ready to use NGINX+UWSGI to redeploy the Apache+mod_wsgi
This article assumes that the infrastructure installation outside of Apache and Mod_wsgi has been completed in accordance with official guidelines Quick MoinMoin on CentOS
Install Nginx
By default, there are no nginx sources under CentOS, you need to manually add them, Access http://nginx.org/en/linux_packages.html#stable download CentOS 6 RPM packages, and install
?
1 2 |
wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm RPM-IVH nginx-release-centos-6-0.el6.ngx.noarch.rpm |
Then execute the following command to install Nginx
Yum Install Nginx
Install Uwsgi
Install the Python Package management tool PIP
?
1 2 |
Yum install python-devel python-setuptools wget Https://raw.github.com/pypa/pip/master/contrib/get-pip.py-O-| Python |
Install Uwsgi via PIP (using Watercress's image)
?
1 |
Pip Install-v uwsgi-i http://pypi.douban.com/simple |
Use Uwsgi to start Moin
Create UWSGI configuration/etc/uwsgi/uwsgi.xml content as follows
?
1 2 3 4 5 6 7 8 9 |
<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> |
One of the 666 is this. Prevent nginx access Moin.sock do not have permissions.
Rename the Moin Wsgi startup script to be UWSGI recognized
?
1 2 |
Cd/usr/local/share/moin MV Moin.wsgi moin_wsgi.py |
To start Uwsgi, you can use the following command
?
1 |
Uwsgi-x/etc/uwsgi/uwsgi.xml |
Configure Nginx Access Uwsgi
The establishment of/etc/nginx/conf.d/moin.conf content is as follows
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23-24 |
# MoinMoin Virtual Host 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; Uwsgi_param uwsgi_pyhome/usr/local/lib/pyt hon2.6/; #site-packages/; Uwsgi_param 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 1M; } } |
Run Nginx
?
Operation and Trouble shooting
Next you can access the Wiki through the browser, but find that the edit and save page is still slow, and then Google a little bit to find a solution to this problem, quickly solve the problem of slow
Edit wikiconfig.py Add the following configuration
Log_reverse_dns_lookups = False
After restarting the UWSGI, visit the Wiki and find the slow problem solved (why I didn't find this article before!)