How to setup HTTPD, PHP, and Python on docker.

Shubhambhalala
2 min readMar 7, 2021

In this article, you will get a kick start in docker and how you can do create a route from container to host i.e. exposing the container, installing software, and configuring it, like Apache httpd. We can also install interpreters and execute programs in it.

Step1: Launching a CentOS container

Here, you can see that we have used an option -p which says that docker has to create a route or PAT for port 80 of container to port 5555 on the host. This will expose port 80 of the container to port 555 of the host.

Step2: Installing necessary packages

Here we are installing necessary libraries or programs in it using the yum command. We will install PHP, httpd, python, net-tools.

Step3: Writing code file and testing the environment

Now, we will write some PHP code and HTML code in the document root of the apache webserver.

PHP code
index.html code

Finally, we will execute the PHP code and then write a python code for testing the environment.

executing PHP code
Testing the python environment

Step4: Testing the webserver

Starting the Apache HTTPD service
The webserver is working great with expose.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Shubhambhalala
Shubhambhalala

Written by Shubhambhalala

C|EH | Cybersecurity researcher | MLOps | Hybrid Multi Cloud | Devops assembly line | Openshift | AWS EKS | Docker

No responses yet

Write a response