$ docker run -p 80:80 -it --name ubuntu ubuntu /bin/bash
# apt-get update
# apt-get upgrade
# apt-get install vim
# apt-get install net-tools
# apt-get install apache2
# apt-get install libapache2-mod-python
# apt-get install python3
# apt-get install python3-pip
# pip3 install -U pip
# apache2 -v
# service apache2 start
# netstat -anp | grep LISTEN | grep :80
# apt-get install curl
# vi /etc/apache2/apache2.conf
---
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
AddHandler mod_python .psp .psp_ .py
PythonHandler mod_python.psp | .psp .psp_
PythonHandler mod_python.cgihandler | .py
PythonHandler mod_python.publisher | .py
PythonDebug On
</Directory>
---
# service apache2 restart
# vi /var/www/html/hello2.py
---
print "Content-type: text/html\n"
print "Hello, Python!
---
# curl http://localhost/hello.py
# vi /var/www/html/hello.psp
---
<html>
<body>
<h2><%= 'Hello, PSP!' %></h2>
</body>
</html>
---
# curl http://localhost/hello.psp
# vi /var/www/html/hello2.py
---
from mod_python import apache
def handler(req):
req.content_type = 'text/html'
req.write("<html>\n")
req.write("<body>\n")
req.write("Hello, Publisher!\n")
req.write("<body>\n")
req.write("</html>\n")
---
# curl http://localhost/hello2.py/handler
# apt-get update
# apt-get upgrade
# apt-get install vim
# apt-get install net-tools
# apt-get install apache2
# apt-get install libapache2-mod-python
# apt-get install python3
# apt-get install python3-pip
# pip3 install -U pip
# apache2 -v
# service apache2 start
# netstat -anp | grep LISTEN | grep :80
# apt-get install curl
# vi /etc/apache2/apache2.conf
---
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
AddHandler mod_python .psp .psp_ .py
PythonHandler mod_python.psp | .psp .psp_
PythonHandler mod_python.cgihandler | .py
PythonHandler mod_python.publisher | .py
PythonDebug On
</Directory>
---
# service apache2 restart
# vi /var/www/html/hello2.py
---
print "Content-type: text/html\n"
print "Hello, Python!
---
# curl http://localhost/hello.py
# vi /var/www/html/hello.psp
---
<html>
<body>
<h2><%= 'Hello, PSP!' %></h2>
</body>
</html>
---
# curl http://localhost/hello.psp
# vi /var/www/html/hello2.py
---
from mod_python import apache
def handler(req):
req.content_type = 'text/html'
req.write("<html>\n")
req.write("<body>\n")
req.write("Hello, Publisher!\n")
req.write("<body>\n")
req.write("</html>\n")
---
# curl http://localhost/hello2.py/handler
댓글
댓글 쓰기