Hi, I am trying to configure apache2 server for python, I used this command to install apache2:
sudo apt-get install apache2
cd /etc/apache2/mods-enabled/
sudo ln -s ../mods-available/mod_python.load mod_python.load
cd /etc/apache2/sites-available/
sudo gedit default
edited the default file:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride AuthConfig
Order allow,deny
allow from all
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
</Directory>
I used this command later:
sudo /etc/init.d/apache2 restart
I received an error message:
* Starting web server apache2 apache2: Syntax error on line 204 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/mod_python.load: LoadModule takes two arguments, a module name and the name of a shared object file to load it from
when I tried to see that the link that is present in mod_python.load using the cat command, I got LoadModule python_module / usr/lib/apache2/modules/mod_python.so
please help me.
Continued .. Now I get a new error Sir, I placed the hello.py file with the code
print "Content-type:text/html\r\n\r\n"
print '<html>'
print '<head>'
print '<title>Hello Word - First CGI Program</title>'
print '</head>'
print '<body>'
print '<h2>Hello Word! This is my first CGI program</h2>'
print '</body>'
print '</html>'
in the cgi-bin folder in /var/www
when I run this on apache2 using
http: //localhost/cgi-bin/hello.py
I get this error
The requested URL /cgi-bin/hello.py was not found on this server.
Apache/2.2.14(Ubuntu)Server at localhost Port 80
source
share