Django feature-integrated Apache, integrated Nginx

Source: Internet
Author: User

Eight, Djiango combined with apache-WSGI module

1) Mounting module

Yum Install-y Mod_wsgi

Yum Install-y httpd


Description: Apache Auto Load profile module

Cat/etc/httpd/conf.modules.d/10-wsgi.conf

LoadModule Wsgi_module modules/mod_wsgi.so


2) Create a new configuration file

Cat/etc/httpd/conf.d/django.conf

<virtualhost *:80>wsgidaemonprocess Simplecmdb python-path=/opt/simplecmdb:/usr/lib64/python2.7/ Site-packageswsgiprocessgroup Simplecmdbwsgiscriptalias//opt/simplecmdb/simplecmdb/wsgi.pyalias/static/usr/ Lib64/python2.7/site-packages/django/contrib/admin/static</virtualhost><directory "/opt/simplecmdb/ Simplecmdb ">require all Granted</directory><directory"/usr/lib64/python2.7/site-packages/django/ Contrib/admin/static ">require all Granted</directory>wsgisocketprefix/var/run/wsgi

Description:/OPT is the project path, can be copied first, not the root directory, and the path of the Jdango package

CP-RP simplecmdb//opt/

Chown-r Apache:apache/opt/simplecmdb


3) Start Apache


4) Access



Ix. Django combined nginx-Gunicron module

1) Install module, need epel extension source

Yum install-y Nginx

Pip Install Gunicron


2) Modify the Nginx configuration file

Cat/etc/nginx/conf.d/virtual.confserver {Listen 192.168.2.230:9000;server_name localhost;location/static/admin { Root/usr/lib64/python2.7/site-packages/django/contrib/admin/;index index.html index.htm;} Location/{Proxy_pass http://localhost:8000;}}


3) boot configuration file and Nginx

Gunicorn simplecmdb.wsgi:application-d

Systemctl Start Nginx.service



4) Start Nginx, view


Django feature-integrated Apache, integrated Nginx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.