Apache windows create new server

Here's a step-by-step guide to creating a new Apache server on Windows:

Prerequisites:

  1. Windows 10 or later (64-bit)
  2. Apache HTTP Server 2.4 or later
  3. A text editor (e.g., Notepad++, Sublime Text)

Step 1: Download and Install Apache

  1. Go to the Apache HTTP Server download page and download the Windows version of Apache.
  2. Run the installer (e.g., Apache24-win64-x64.msi) and follow the installation wizard.
  3. Choose the installation location (e.g., C:\Apache24) and select the components you want to install (e.g., HTTP Server, SSL/TLS Support).

Step 2: Configure Apache

  1. Open a text editor and create a new file called httpd.conf in the Apache installation directory (e.g., C:\Apache24\conf).
  2. Copy the following code into the file:
    
    # Apache configuration file

ServerName directive sets the hostname and port that the server uses

to identify itself. This can be presented to a client in response

to their HTTP request.

ServerName localhost:80

DocumentRoot directive sets the directory from which web pages

are served.

DocumentRoot "C:/Apache24/htdocs"

AllowOverride directive allows.htaccess files to override

settings in this file.

AllowOverride None

Options directive sets the options for the directory.

Options Indexes FollowSymLinks

ErrorLog directive sets the location of the error log file.

ErrorLog "logs/error.log"

CustomLog directive sets the location of the access log file.

CustomLog "logs/access.log" common

3. Save the file.

**Step 3: Create a Virtual Host**

1. Create a new file called `virtualhosts.conf` in the Apache configuration directory (e.g., `C:\Apache24\conf`).
2. Copy the following code into the file:
```bash
# Virtual hosts configuration file

<VirtualHost *:80>
    ServerName example.com
    DocumentRoot "C:/Apache24/htdocs/example"
</VirtualHost>

Replace example.com with your desired domain name and C:/Apache24/htdocs/example with the directory where your website files will be stored.

Step 4: Start Apache

  1. Open a Command Prompt or PowerShell as an administrator.
  2. Navigate to the Apache installation directory (e.g., C:\Apache24).
  3. Run the following command to start Apache:
    httpd.exe
  4. Apache should start and you should see a message indicating that it's running.

Step 5: Test Apache

  1. Open a web browser and navigate to http://localhost or http://example.com (if you created a virtual host).
  2. You should see the Apache default page or your website's index page.

That's it! You've successfully created a new Apache server on Windows.