一、安装Horizon、Nginx、uWSGI
yum install -y uwsgi-plugin-python openstack-dashboard uwsgi nginx
二、配置uWSGI
cat >/etc/uwsgi.ini <<EOF [uwsgi] plugins = python master = true processes = 10 threads = 2 chmod-socket = 666socket = 127.0.0.1:9000 pidfile = /tmp/horizon.pidpythonpath = /usr/share/openstack-dashboard chdir = /usr/share/openstack-dashboard/openstack_dashboard wsgi-file = /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi EOF
三、配置Nginx
cat >/etc/nginx/conf.d/horizon.conf <<EOF server { listen 80;server_name 127.0.0.1;location / {include uwsgi_params;uwsgi_pass 127.0.0.1:9000;}location /static {alias /usr/share/openstack-dashboard/static/;} } EOF
四、配置Horizon
python /usr/share/openstack-dashboard/manage.py compress
修改:/etc/openstack-dashboard/local_settings中的WEBROOT为:‘/’
五、启动服务
systemctl start uwsgi.servicesystemctl start nginx.service
六、参考资料:
https://developer.rackspace.com/blog/keystone_horizon_nginx/
http://www.xiaoyinzei.com/2015/07/
http://uwsgi-docs.readthedocs.org/en/latest/Nginx.html