DZone
DevOps Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > DevOps Zone > Migrating from Apache to Nginx with the Edison Build System

Migrating from Apache to Nginx with the Edison Build System

Matthew Macdonald-wallace user avatar by
Matthew Macdonald-wallace
·
May. 27, 12 · DevOps Zone · Interview
Like (0)
Save
Tweet
6.41K Views

Join the DZone community and get the full member experience.

Join For Free

I’ve recently decided to take the plunge and move from Apache and Mod_WSGI to Nginx and FastCGI – I was amazed at how simple it was!

To get Edison up and running under Nginx as a fast-cgi Deamon, you just need to do the following:

Install the required packages from EPEL:

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

yum update

yum install nginx pypthon-flup

The configure a new server (we’ll setup a fake dns hostname of ‘edison.localdomain’) in /etc/nginx/conf.d/edison as follows:

    server {
    # setup the server name
    server_name edison.localdomain;

    # make sure we’re only listening on HTTPS
    listen 443;

    ssl                  on;
    ssl_certificate      /path/to/ssl/edison.localdomain.crt;
    ssl_certificate_key  /path/to/ssl/edison.localdomain.key;

    # Point to the document root
    root /var/djangosites/edison/;

    # setup logging
    error_log /var/log/nginx/edison.localdomain.error;
    access_log /var/log/nginx/edison.localdomain.access;

    # Setup the alias for the Media Directory
    location /media {
    alias /var/djangosites/edison/media/;
    }

    # setup the fastcgi settings
    location / {
    # host and port to fastcgi server
    fastcgi_pass 127.0.0.1:8801;
    fastcgi_param PATH_INFO $fastcgi_script_name;
    fastcgi_param REQUEST_METHOD $request_method;
    fastcgi_param QUERY_STRING $query_string;
    fastcgi_param SERVER_NAME $server_name;
    fastcgi_param SERVER_PORT $server_port;
    fastcgi_param SERVER_PROTOCOL $server_protocol;
    fastcgi_param CONTENT_TYPE $content_type;
    fastcgi_param CONTENT_LENGTH $content_length;
    fastcgi_param REMOTE_USER       $remote_user;
    fastcgi_param REMOTE_ADDR       $remote_addr;
    fastcgi_param REMOTE_PORT       $remote_port;
    fastcgi_pass_header Authorization;
    fastcgi_intercept_errors off;
    }
    }

Once that’s in place, restart NGinx and then cd to the Edison App dir and run the following command:

./manage.py runfcgi method=threaded host=127.0.0.1 port=8801

This will start the fast-cgi python script.

Now you can visit https://edison.localdomain/ (assuming it is setup in your DNS!) and you should be able to browse Edison without any issue.

Build (game engine)

Published at DZone with permission of Matthew Macdonald-wallace, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • How to Use Geofences for Precise Audience Messaging
  • The Most Popular Technologies for Java Microservices Right Now
  • Testing Under the Hood Or Behind the Wheel
  • Ultra-Fast Microservices in Java: When Microstream Meets Open Liberty

Comments

DevOps Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo