Skip to main content

:: [mod] python on apache httpd

:: whatis
please take a look at this.

:: installing dependency
[+] please install apache httpd on your server

:: installing python on apache
[+] compile and install python
[ root:~ ]# mkdir download
[ root:~ ]# cd download/
[ root:download ]# wget http://python.org/ftp/python/2.6.2/Python-2.6.2.tar.bz2
[ root:download ]# tar -xjf Python-2.6.2.tar.bz2
[ root:download ]# cd Python-2.6.2
[ root:Python-2.6.2 ]# ./configure --enable-shared
[ root:Python-2.6.2 ]# make && make install
[ root:Python-2.6.2 ]# ldconfig

[+] compile and install flex
[ root:download ]# wget http://sourceforge.net/projects/flex/files/flex/flex-2.5.35/flex-2.5.35.tar.bz2/download
[ root:download ]# tar -xjf flex-2.5.35.tar.bz2
[ root:download ]# cd flex-2.5.35
[ root:flex-2.5.35 ]# ./configure
[ root:flex-2.5.35 ]# make && make install

[+] compile and install mod_python
[ root:download ]# wget http://apache.pesat.net.id/httpd/modpython/mod_python-3.3.1.tgz
[ root:download ]# tar -xzf mod_python-3.3.1.tgz
[ root:download ]# cd mod_python-3.3.1
[ root:mod_python-3.3.1 ]# ./configure --with-apxs=/usr/local/apache2/bin/apxs
[ root:mod_python-3.3.1 ]# vi src/connobject.c
#142 (on line #142)

change:

!(b == APR_BRIGADE_SENTINEL(b) ||

to

!(b == APR_BRIGADE_SENTINEL(bb) ||


[ root:mod_python-3.3.1 ]# make install_dso && make install_py_lib

:: configuring apache httpd for support mod_python

[ root:mod_python-3.3.1 ]# vi /usr/local/apache2/conf/httpd.conf

#
# Add this line for load mod_python
#
LoadModule python_module modules/mod_python.so

#
# example configuration on httpd.conf
#
<directory "/usr/local/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all

#
# enable mod_python configuration
#
<ifmodule mod_python.c>
AddHandler mod_python .py .psp
PythonHandler mod_python.publisher | .py
PythonHandler mod_python.psp | .psp
</ifmodule>
</directory>

:: restart apache httpd service
[ root:~ ]# /usr/local/apache2/bin/apachectl stop
[ root:~ ]# /usr/local/apache2/bin/apachectl start

:: make testing python files
[+] Python PublisherHandler
[ root:~ ]# vi /usr/local/apache2/htdocs/python.py
def index(req):
return "Hello Guys.. (Publisher Handler)";

[+] PythonServerPages
[ root:~ ]# vi /usr/local/apache2/htdocs/python.psp
<html>
<body>
<%req.write("Hello Guys..(PythonServerPages)")%>
</body>
</html>

:: links
+ GoogleLinux
+ BlacKonsole

Comments

Popular posts from this blog

Simple Step Installing WordPress in Ubuntu 24.04

Using ols1clk.sh Script This step will: Install OpenLiteSpeed Install PHP Secure your server Install MySQL Set up WordPress Run the script: bash <( curl -k https://raw.githubusercontent.com/litespeedtech/ols1clk/master/ols1clk.sh ) -w  Configuring WordPress Open your browser and navigate to your domain: http://yourdomain.com You’ll be greeted by the famous WordPress installation wizard. Follow these steps: Select your preferred language. Enter your site title, username, and password for the WordPress admin account. Click "Install WordPress." And just like that, you’ve done it!

:: Install NginX from source

:: What is NGINX nginx [engine x] is an HTTP and reverse proxy server, as well as a mail proxy server, written by  Igor Sysoev . o nginx :: How to install NGINX from source on OpenSUSE + installing dependency # zypper in pcre-devel zlib-devel libopenssl-devel + create username and group # groupadd nginx # useradd -r -g nginx nginx + compile and installing nginx # wget http://nginx.org/download/nginx-1.1.8.tar.gz # tar -xzf nginx-1.1.8.tar.gz # cd nginx-1.1.8 # ./configure --user=nginx --group=nginx --with-http_ssl_module # make && make install :: Starting / restarting httpd # /usr/local/nginx/sbin/nginx # /usr/local/nginx/sbin/nginx -s reload :: Link + Google + BlacKonsole

:: How to Recompile Nginx in Ubuntu

  Recompiling Nginx on Ubuntu can be a crucial task for those who need to customize their web server to meet specific requirements. Whether you need to add new modules, optimize performance, or apply patches, recompiling Nginx allows you to tailor the server to your needs. This guide will walk you through the process step-by-step, ensuring you have a smooth and successful recompilation.   Understanding the Need for Recompilation Why Recompile Nginx? Recompiling Nginx is often necessary when you need to add or remove modules that are not included in the default package. For instance, if you need to integrate a third-party module for enhanced security or performance, recompilation is the way to go. Additionally, recompiling allows you to apply custom patches or optimizations that can significantly improve your server's efficiency. Benefits of Custom Compilation Custom compiling Nginx offers several advantages. Firstly, it provides greater control over the server'...