Build nginx + uwsgi + cgi platform in Centos

Source: Internet
Author: User

1. Install nginx

Add nginx Source

[Plain] view plaincopy
  1. <Span style = "font-size: 18px;"> [nginx]

  2. Name = nginx repo

  3. Baseurl = http://nginx.org/packages/centos/?releasever/?basearch/

  4. Gpgcheck = 0

  5. Enabled = 1

  6. </Span>

Install nginx
[SQL] view plaincopy
  1. <Span style = "font-size: 18px;"> # yum install nginx </span>


2. Compile and install uwsgi
[Plain] view plaincopy
  1. <Span style = "font-size: 18px;"> # http://projects.unbit.it/uwsgi/

  2. Wget http://projects.unbit.it/downloads/uwsgi-1.9.13.tar.gz

  3. Tar-zxvf uwsgi-1.9.13.tar.gz

  4. # Directly compile the cgi Mode uwsgi

  5. Cd uwsgi-1.9.13

  6. Python uwsgiconfig. py -- build buildconf/cgi. ini </span>


3 Configuration

Uwsgi ini configuration. The. cgi and. pl extensions are enabled below. The local port 9001 is used to enable four worker processes.
[Plain] view plaincopy
  1. <Span style = "font-size: 18px;"> [uwsgi]

  2. ; Plugins = cgi

  3. Workers = 4

  4. Socket = 127.0.0.1: 9001

  5. Cgi =/var/www/cgi-bin

  6. Cgi-allowed-ext =. cgi

  7. Cgi-allowed-ext =. pl </span>


Nginx Configuration
Vi/etc/nginx/conf. d/default
Added. cgi. pl support
[Plain] view plaincopy
  1. <Span style = "font-size: 18px;"> location ~ . Cgi $ {

  2. Include uwsgi_params;

  3. Uwsgi_modifier1 9;

  4. Uwsgi_pass 127.0.0.1: 9001;

  5. }

  6. Location ~ . Pl $ {

  7. Include uwsgi_params;

  8. Uwsgi_modifier1 9;

  9. Uwsgi_pass 127.0.0.1: 9001;

  10. } </Span>



4. Start
# Nginx

# Uwsgi-m -- ini cgi. ini-d/var/log/uwsgi/access. log


5. Test



:) Perfect.


Refer:
Http://uwsgi-docs.readthedocs.org/en/latest/CGI.html


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.