Appache configuration for Python on Linux

for professional and freshers



Apache2 is the normal http webserver. Python, Perl, PHP scripts are using this server for web applications. If we want to run these scripts, we should configure the apache2 server with that scripts.  to configure apache for python on linux you need to perform following steps.

step 1. open "default"  file present in apache installation folder inside -  >sites available folder.

step 2 : add below script anywhere in default file.

             <Directory /var/www/python>
        Options +ExecCGI
        AddHandler cgi-script .py
    </Directory>

step 3 : Craete python folder inside www folder 

step 4: stop server
                                sudo service appache2 stop

step 5 :start server
                                 sudo service appache2 strat


step 6 :Now create python file in python folder

   #!/usr/bin/python2             // python exe path. location of python exe
print("Content-Type:text/html")
print("")
print("hello");

step 7 : save file with .py extension and assign permission : 

cd /var/www/python chmod 777 hello.py

step 8: open web browser and type localhost/python 

output : hello


step 9 : open web browser and



Comments

Popular posts from this blog

Filter In Javafx

Kotlin with StandAlone Complier