Execute python files with Nginx

Hello,
How can we execute python files with Nginx? Anybody can help
me
to give steps by steps to follow. In Apache, it is very easy to execute
python files but in python, I am trying from last 2 days and nothing
happening. Any Idea how to use “uwsgi” ?

Hello,

I’ve never used python with nginx, but there are some examples on how to
configure everything here:

Best Regards

Posted at Nginx Forum:

I tried that and getting issues. Unable to configure. I am not getting
those steps. Any help you can do by explaining in steps…

Hi Nitin,

Would you mind providing a bit more information?

On Aug 6, 2015, at 4:53 AM, Nitin S. [email protected] wrote:

I tried that and getting issues. Unable to configure. I am not getting those
steps. Any help you can do by explaining in steps…

What issues are you running into? Can you copy and paste any errors
you’re receiving?

Can you provide the configuration file you are using?

What is the behavior you are expecting and what is the behavior you’re
seeing?

Hi,
Right now, I am not office… I am from India… Now, it is 1.42
am.
It will be great. If you provide step by step from beginning. Is it
possible to mail. Thanks.

Hi Nitin,

If you’re using django you can follow these steps:

Daniel Theodoro
Cel: 11 99399-3364
http://www.linkedin.com/in/danieltheodoro

• RHCA - Red Hat Certified Architect
• RHCDS - Red Hat Certified Datacenter Specialist
• RHCE - Red Hat Certified Engineer
• RHCVA - Red Hat Certified Virtualization Administrator
• LPIC-3 - Senior Level Linux Certification
• Novell Certified Linux Administrator - Suse 11
• OCA - Oracle Enterprise Linux Administrator Certified Associate

Hi Daniel,
I am not using Django. I am using core python files.
Is
it possible with it?

On Tue, Aug 11, 2015 at 6:21 PM, Daniel Theodoro
[email protected]

Thanks Shannon…

Hello nitin
Please check this configuration.It works for you.
Server {

listen localhost:8080;

    listen [::]:8060 ipv6only=on;

    root /var/www;

    index index.html index.htm index.py;

location /html/ {

 # Disable gzip (it makes scripts feel slower since they have to

complete

 # before getting gzipped)

 gzip off;

 # Set the root to /usr/lib (inside this location this means that we

are

 # giving access to the files under /usr/lib/cgi-bin)

 #root  /var/www;

 # Fastcgi socket

 fastcgi_pass  unix:/var/run/fcgiwrap.socket;

 # Fastcgi parameters, include the standard ones

 include /etc/nginx/fastcgi_params;

 # Adjust non standard parameters (SCRIPT_FILENAME)

 fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;

}

}

Hi Nitin,

If you are looking for a tutorial on how to get a python application up
and running with NGINX check out this tutorial:

https://www.digitalocean.com/community/tutorials/how-to-set-up-uwsgi-and-nginx-to-serve-python-apps-on-ubuntu-14-04

For future reference, Digital Ocean has some really well written
tutorials to give you a place to start.

Our community is a great place to ask questions once you get stuck. The
best way to get help when you are stuck is to send:

*your configuration file
*the error logs you’re getting
*any other relevant code

I find it most helpful if someone also includes what behavior they are
expecting the program to perform and what they are seeing it do in
reality.

Hopefully this is helpful!

Shannon
Jr. Developer Advocate
NGINX