How to Install Apache Web Server on Windows – SitePoint

Starting web development is easy: you create a file called something.html, edit it in Notepad, and load it in a browser. Simple sites can be built using this process, but to really explore the possibilities, you need a web server.
This popular article was updated in 2020 to provide the most helpful and accurate guidance .

What is a Web Server?

( Skip to the adjacent section if you prefer … )

A vane server is software that listens for requests and returns data ( normally a file ). When you type “ www.mysite.com ”, the request is forwarded to a machine running network server software which returns a file back to your browser — such as the contents of index.html. The browser might then make foster requests based on the HTML contentedness — like CSS, JavaScript, and graphic files .
Since the web server sits between your browser and the requested file, it can perform work that ’ s not possible by opening an HTML charge immediately. For exercise, it can parse PHP code which connects to a database and returns data .
You can use your host ’ randomness network server for testing, but uploading will become boring and changes could go hot before they ’ ve been in full tested. What you need is a local web server initiation .

Why Apache?

In cosmopolitan, it ’ second good to use the network server software that your web host uses. Unless you ’ re creating ASP.NET applications on Microsoft IIS, your host is probable to use Apache — the most far-flung and fully-featured web server available. It ’ s an open-source project, so it doesn ’ thymine price anything to download or install .
The follow instructions describe how to install Apache on Windows. macOS comes with Apache and PHP. Most linux users will have Apache pre-installed or available in the al-qaeda repositories .

All-in-one Packages

There are some excellent all-in-one Windows distributions that contain Apache, PHP, MySQL and other applications in a individual installation file — such as XAMPP ( for Windows, Linux and macOS ), WampServer and WampDeveloper Pro. There ’ mho nothing faulty with using these packages, although manually installing Apache will help you learn more about the system and its shape options .

The Apache Installation Wizard

An excellent official .msi initiation sorcerer is available from the Apache download page. This choice is surely recommended for novice users or possibly those installing Apache for the beginning time .

Manual Installation

manual initiation offers several benefits :

  • Backing up, reinstalling, or moving the web server can be achieved in seconds.
  • You have more control over how and when Apache starts.
  • You can install Apache anywhere, such as a portable USB drive (useful for client demonstrations).

Step 1: Configure IIS

Apache listens for requests on TCP/IP port 80. You need to uninstall or disable any program that uses that port. If you have a Professional or Server interpretation of Windows, you may already have IIS installed. If you would prefer Apache, either remove IIS as a Windows part or disable its services .

Step 2: Download the files

We ’ rhenium going to use the unofficial Windows binary from Apache Lounge. This translation has performance and stability improvements over the official Apache distribution, although I ’ thousand so far to notice a significant difference. however, it ’ mho provided as a manually installable ZIP file from www.apachelounge.com/download/ .
You should besides download and install the Windows C++ runtime from Microsoft.com. You may have this installed already, but there is no damage installing it again .
As always, remember to virus read all downloads .

Step 3: Extract the Files

We ’ ll install Apache in C:/Apache24, then extract the ZIP file to the ancestor of the C:/ repel. Apache can be installed anywhere on your organization, but you ’ ll indigence to change SVROOT shape to point to your unzip location — suh as E:/Apache24 .

Step 4: Configure Apache

Apache is configured with the text file conf/httpd.conf contained in the Apache folder. Open it with your favorite text editor program .
bill that all file way settings use a forward slash ( / ) rather than the Windows backslash. If you installed Apache anywhere other than C:/Apache24, nowadays is a beneficial time to search and replace all references to C:/Apache24 .
There are respective lines you should change for your production environment :

  • Line 60, listen to all requests on interface 80 :

    Listen *:80
    
  • Line 162, enable mod-rewrite by removing the # ( optional, but utilitarian ) :

    LoadModule rewrite_module modules/mod_rewrite.so
    
  • Line 227, specify the server domain name :

    ServerName localhost:80
    
  • Line 224, allow .htaccess overrides :

    AllowOverride All
    

Step 4: Change the Web Page Root (optional)

By nonpayment, Apache returns files found in its C:/Apache24/htdocs folder. It ’ sulfur good to use a booklet on an another drive or partition to make backups and re-installation easy. For the purposes of this example, we ’ ll create a folder called D:WebPages and change httpd.conf consequently :

  • Line 251, set the ancestor :

    DocumentRoot  `` five hundred : /WebPages ''
    
  • line 252 :

     
    

Step 5: Test your Installation

Your Apache shape can now be tested. Open a command box ( Start > Run > cmd ) and embark :

 
 four hundred /Apache24/bin
 
httpd -t

It should say “ Syntax OK ”. If not, correct any httpd.conf shape errors and retest until none appear .

Step 6: install Apache as a Windows service

The easiest means to start Apache is to add it as a Windows service. Open a new command prompt as administrator, and enter the watch :

 compact disk /Apache24/bin
httpd -k  install

Open the Control Panel, Administrative Tools, then Services and double-click Apache2.4. Set the Startup character to “ Automatic ” to ensure Apache starts every time you boot your personal computer .
alternatively, set the Startup type to “ Manual ” and establish Apache whenever you choose using the command “ net start Apache2.4 ” .

Step 7: Test the Web server

Create a file named index.html in Apache ’ s web page root ( either htdocs or D:\WebPages ) and add a fiddling HTML code :

 

<

html

>

<

head

>

<

title

>

Testing Apache

title

>

head

>

<

body

>

<

p

>

Apache is working!

p

>

body

>

html

>

guarantee Apache has started successfully, open a web browser and enter the address http://localhost/. If all goes well, your test page should appear .
In general, most problems will be caused by an incorrect rig in the httpd.conf configuration file. Refer to the Apache documentation if you require far information.

Wrap Up

And that ’ s it ! here are some early associate guides :
For more on workflows, watch our screencast What is npm and How Can I Use It ?

source : https://thefartiste.com
Category : Tech

About admin

I am the owner of the website thefartiste.com, my purpose is to bring all the most useful information to users.

Check Also

articlewriting1

Manage participants in a zoom meeting webinar

Call the people who attend the meet as follows Alternate host host Who scheduled the …

Leave a Reply

Your email address will not be published.