How to deploy HTML & Javascript code to Apache Http Server?

If you want just a static http server to serve your web pages for development/learning purpose one of the options is to use Apache Http Server.

Once deployed you can access your files at http://localhost.

Follow the below steps to deploy your html and javascript files to Apache http server :

STEP1: Install Apache HTTP server

STEP2: Configure server root in the installed server

STEP3: Start the server and verify it

STEP4: Place all files in htdocs folder

In detail:

STEP1: Install Apache HTTP server

Download Apache HTTP server by referring to the download section in the below page (for Windows):

http://httpd.apache.org/docs/current/platform/windows.html

You can download the zip file from any of the links in the downloads section.

Once downloaded unzip the file .

STEP2: Configure server root in the installed server

Once unzipped go to conf folder and edit the file httpd.conf

In the above file replace the server root with the location of the folder where you installed the server.

For example , I installed it in the below location:

C:\softwares\Apache24

So I added the server root as :

STEP3: Start the server

To start the server go to bin directory , open command prompt and type httpd.exe and press enter

You won’t see any logs , just go to localhost in your browser:

You will see the below page:

Server is up and running!

STEP3: Place all your files in htdocs folder

Once your server starts properly collect all your html and javascript files and place them in htdocs folder as shown below.

This is where the server looks for the static files.

index.html file is present by default.

Rest other files were added by me in the above screenshot.

I navigated to http://localhost/shop.html and was able to see my code changes:

That’s it!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s