DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Enterprise AI Trend Report: Gain insights on ethical AI, MLOps, generative AI, large language models, and much more.

2024 Cloud survey: Share your insights on microservices, containers, K8s, CI/CD, and DevOps (+ enter a $750 raffle!) for our Trend Reports.

PostgreSQL: Learn about the open-source RDBMS' advanced capabilities, core components, common commands and functions, and general DBA tasks.

AI Automation Essentials. Check out the latest Refcard on all things AI automation, including model training, data security, and more.

Related

  • Identifying, Exploiting, and Preventing Host Header Attacks on Web Servers
  • Application Security Checklist
  • 7 Microservices Best Practices for Developers
  • Can We Do Performance Testing by Selenium Web Driver?

Trending

  • Enhancing Performance With Amazon Elasticache Redis: In-Depth Insights Into Cluster and Non-Cluster Modes
  • Understanding Kernel Monitoring in Windows and Linux
  • Automated Data Extraction Using ChatGPT AI: Benefits, Examples
  • Machine Learning: A Revolutionizing Force in Cybersecurity

Testing Your Website Using an Apache Test Environment

Learn how to host your website on Apache Web Server and set up an Apache test environment to verify functionality.

By 
Harshit Paul user avatar
Harshit Paul
·
Oct. 03, 18 · Tutorial
Like (2)
Save
Tweet
Share
9.8K Views

Join the DZone community and get the full member experience.

Join For Free

Launched in 1995, Apache Web Server has sometimes been considered the most popular web server on the internet. The name in itself is said to have rewritten history.

What Is Apache Web Server?

Apache Web Server is the most widely used open-source, cross-platform web server for hosting HTTP-based websites. It is free to download and is considered to be a reliable platform by a majority of internet consumers on a global scale. By November 2013, it was responsible for running 67% of all the web servers around the globe, though that popularity is now steadily decreasing.

Apache is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation.

The software is available for the below mentioned operating systems:

  • Unix
  • FreeBSD
  • Linux
  • Solaris
  • Novell Netware
  • OS X
  • Microsoft Windows
  • OS/2
  • TPF
  • OpenVMS
  • eComStation

Key features:

  • Support for numerous programming languages
  • Provides an authentication mechanism for user login
  • Facilitates database support
  • Supports Server Side Scripting

With the gradual passage of time, the popularity of Apache has been slowly fading. The major reason behind that is Nginx.

According to the above statistics presented by W3Techs.com, Nginx has developed an eminent place among web servers.

Some popular sites using Nginx are

  • WordPress.com
  • Pinterest.com
  • 360.cn
  • Twitch.tv
  • Mail.ru
  • Csdn.net

Wondering Which Web Server You're Using?

The answer to that lies in your website’s HTTP header, although, it is not always visible.

You may view the website’s HTTP header by using the Network tab in Chrome Dev Tools, or you can use tools like Pingdom or GTmetrix.

This method is not feasible if you are using Cloudflare or a similar service provider.

Decided on Apache? First, Set Up a Local Apache Environment

Service providers like XAMPP, LAMP, and WAMP have made it all too easy to deploy an Apache web server for hosting your locally stored website.

Step 1 → Download XAMPP → https://www.apachefriends.org/download.html

Step 2 → Start the installation and provide a directory for it.

Installation may take a couple minutes. This is how it should look once the setup is complete. Click Finish.

Step 3 → You will get a window for selecting the language. Hit Save on your preferred one.

Step 4 → After selecting the language, XAMPP will open. You need to hit Start on Apache, and that’s it! You will have Apache running.

Step 5 → Go to your browser and type http://127.0.0.1 or http://localhost:80 to verify Apache web server hosting by XAMPP by visiting the dashboard.

Local Hosting a Website Through XAMPP

I will be demonstrating this with the help of the Road Trip template.

Step 1 → Head to the Road Trip template’s link and download it.

Step 2 → Extract the download folder into XAMPP (root directory) → htdocs

Step 3 → Run Apache on XAMPP.

Step 4 → Go to your browser and enter in the URL → localhost/roadtrip.

Note that I am mentioning Road Trip after localhost because that is how I named the template’s folder in my htdocs. If you have come up with some other name, say, “roadtrip-template” then your URL would be localhost/roadtrip-template.

Now that your website is hosted, you can go on ahead and make changes in its source code using any text editor. Notepad++ and Sublime Text are my personal favorites.

To check the back-end functionality of your website, you will have to start MySQL along with Apache under the XAMPP Control Panel.

If you are not willing to use XAMPP, then you can download and install Apache from Apache Lounge.

Once you are on the website, then download either 32-bit or 64-bit, depending upon your Windows Server setting.

I will be using Apache 2.4.34 Win64 for this tutorial.

Step 2 – Extract the downloaded zip file. Extract it to the location of your server.

Step 3 – Configuring Apache:

  • Locate the “httpd.conf” file and open it in any standard text editor.
  • If you extracted Apache at any other directory than the default C:\Apache24 then you ought to update the configuration file accordingly.ServerRoot C:/Apache24 →ServerRoot D:/Apache
    DocumentRoot C:/Apache24/htdocs →DocumentRoot D:/Apache/htdocs
    Directory C:/Apache24/htdocs> →Directory D:/Apache/htdocs
    ScriptAlias /cgi-bin/ C:/Apache24/cgi-bin/ → ScriptAlias /cgi-bin/ D:/Apache/cgi-bin/
  • You would also need make the following modification in the configuration file.
    • Options Indexes FollowSymLinks →Options Indexes FollowSymLinks ExecCGI
    • Remove the # symbol at the start of this line to uncomment: AddHandler cgi-script .cgi
    • Also add the line, AddHandler cgi-script .pl
    • At the end of the file, you must add this line: ScriptInterpreterSource Registry

Step 4 – Launch Apache by going into the extracted directory. → Apache → Bin → Open Powershell here or Open Command Prompt here(Shift + Right click)

Step 5 – Test if your Apache is running by typing http://127.0.0.1. You should get the below response:

Test Your Locally Hosted Websites and Web Apps Using LambdaTest

If you are looking for something simpler than XAMPP to serve your purpose of testing on Apache test environment, then let me inform you about LambdaTest.

LambdaTest provide a feature to test your locally hosted webpages using the tunnel hosted through LambdaTest cloud servers. You can perform testing on simple and plain HTML, CSS, Python, PHP etc. similar web files that are stored on your local system.

Performing a real-time interactive cross browser testing is not only easy but is also helpful in figuring out whether the new feature is supported through multiple browsers prior to launching it into your Production environment.

LambdaTest has a Step-by-Step guide related to Tunnel configuration for Testing Locally Hosted Websites and Web apps.

You can also check how the template would appear on a different browser in a different OS.

Testing Web server Web Service

Published at DZone with permission of Harshit Paul, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Identifying, Exploiting, and Preventing Host Header Attacks on Web Servers
  • Application Security Checklist
  • 7 Microservices Best Practices for Developers
  • Can We Do Performance Testing by Selenium Web Driver?

Partner Resources


Comments

ABOUT US

  • About DZone
  • Send feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: