WebVirMgr的搭建过程
作者:互联网
操作系统内核: uname -r
操作系统: lsb_release -a
yum -y install http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm yum -y install git python-pip libvirt-python libxml2-python python-websockify supervisor nginx yum -y install gcc python-devel
查看pip是否已经安装 pip --help
pip install numpy
- 安装Python环境和Django环境
git clone git://github.com/retspen/webvirtmgr.git cd webvirtmgr pip install -r requirements.txt pip install --upgrade pip(此命令可以不执行) ./manage.py syncdb
执行命令输出内容如下:
You just installed Django's auth system, which means you don't have any superusers defined. Would you like to create one now? (yes/no): yes Username (leave blank to use 'root'): root Email address: 1878547732@qq.com Password: zhl****! Password (again): Superuser created successfully. Installing custom SQL ... Installing indexes ... Installed 6 object(s) from 1 fixture(s) 下面的命令是管理员账号,用户名,密码就是上面设置的用户名密码。 ./manage.py collectstatic This will overwrite existing files! Are you sure you want to do this? Type 'yes' to continue, or 'no' to cancel: yes ./manage.py createsuperuser 添加另外一个用户 (不添加也行)
[root@iZ2zeeg42qkecbgssbgkqtZ webvirtmgr]# ./manage.py createsuperuser
WARNING:root:No local_settings file found. Username: admin Email address: 1878547732@qq.com Password: zhl***! Password (again): Superuser created successfully.
[root@iZ2zeeg42qkecbgssbgkqtZ webvirtmgr]#
#cd …
此时路径在 /root 下
sudo mv webvirtmgr /var/www/
vim /etc/nginx/conf.d
server { listen 80 default_server; server_name $hostname; #access_log /var/log/nginx/webvirtmgr_access_log; location /static/ { root /var/www/webvirtmgr/webvirtmgr; # or /srv instead of /var expires max; } location / { proxy_pass http://127.0.0.1:8000; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for; proxy_set_header Host $host:$server_port; proxy_set_header X-Forwarded-Proto $scheme; proxy_connect_timeout 600; proxy_read_timeout 600; proxy_send_timeout 600; client_max_body_size 1024M; # Set higher depending on your needs } }
#表格里的全部注释掉
vim /etc/nginx/nginx.conf
# server { # listen 80 default_server; # server_name localhost; # root /usr/share/nginx/html; # # #charset koi8-r; # # #access_log /var/log/nginx/host.access.log main; # # # Load configuration files for the default server block. # include /etc/nginx/default.d/*.conf; # # location / { # } # # # redirect server error pages to the static page /40x.html # # # error_page 404 /404.html; # location = /40x.html { # } # # redirect server error pages to the static page /50x.html # # error_page 500 502 503 504 /50x.html; # location = /50x.html { # } # }
#chown -R nginx:nginx /var/www/webvirtmgr #service nginx restart #/usr/sbin/setsebool httpd_can_network_connect true #chkconfig supervisord on #chown -R nginx:nginx /var/www/webvirtmgr
#vim /etc/supervisord.d/webvirtmgr.ini
[program:webvirtmgr] command=/usr/bin/python /var/www/webvirtmgr/manage.py run_gunicorn -c /var/www/webvirtmgr/conf/gunicorn.conf.py directory=/var/www/webvirtmgr autostart=true autorestart=true logfile=/var/log/supervisor/webvirtmgr.log log_stderr=true user=nginx [program:webvirtmgr-console] command=/usr/bin/python /var/www/webvirtmgr/console/webvirtmgr-console directory=/var/www/webvirtmgr autostart=true autorestart=true stdout_logfile=/var/log/supervisor/webvirtmgr-console.log redirect_stderr=true user=nginx
- 重新启动supervisor守护程序
service supervisord stop
service supervisord start
- 访问测试
./manage.py runserver 0:8000
http://39.97.97.79:8000/login/
标签:www,WebVirMgr,log,server,nginx,var,过程,webvirtmgr,搭建 来源: https://blog.51cto.com/xinsz08/2706513