Running a python script on Nginx

9,987

Noap, you cant run python scripts by replacing the index.html. Doing so, you are serving a python file to the client/web-browser where he doesnt know how to interpret it.

As you correctly stated, you may use uWSGI in order to execute python scripts on your server.

Share:
9,987

Related videos on Youtube

srj0408
Author by

srj0408

Earlier I was working as a TEAM leader in UAV development project in my college and i was very much in planning and execution, but i was not in depth of coding.NOw after doing work for 1 year in the field of embedded system and engineering/Training i am in pure programming/Embedded linux.I am very much eager to learn C and right now using ncurses library which seems to be very usefull but it will take a long time to be expert at.

Updated on September 18, 2022

Comments

  • srj0408
    srj0408 over 1 year

    This question might sound a bit odd to the people hanging out here, but i am just trying to start learning server side programming

    Is it possible to run a python script directly in a Nginx server just by replacing

    root /usr/share/nginx/html;
        index index.py; // instead of index.html index.htm 
    

    I tried running the same, but no result. All i was trying is to get the post data of the request and print it on a web-page.

    I have searched a bit on google and found how to run python script using uWSGI and Ngnix - link. I will defiantly go ahead and try this one, but it would be really nice, if some one can clear my doubt.

    Thanks in advance.

    • EEAA
      EEAA almost 8 years
      You need a wsgi interpreter.