How to install Apache and start the site under Windows
How to install Apache and start the site under Windows? The following article will introduce to you the steps to install Apache and start the site under Windows. It has certain reference value. Friends who need it can refer to it. I hope it will be helpful to everyone.
1.apache official website to download the Apache HTTP Server server
I believe that some friends want to download the Apache HTTP Server from the official website when they first use the apache server Download it online, but facing the numerous projects, images and directories on the official website, you may be a little confused. The following are the specific steps:
①, Open the apache official website http://httpd.apache.org/ (or Baidu "download apache").
②、Click Download and the following interface will appear.
③、Select the Windows version to download and click the link.
##④、In the new interface, you will find the words VC9 and VC11. By reading the relevant content, you will know that VC9 refers to compiled with VS2008 The code, while VC11 is compiled with VS2012, and the code compiled with VS2012 cannot be used in Windows XP and Server 2003. For the sake of better compatibility, I chose to use VC9 to compile Apache. I chose to download it here and the download process is complete!
Apache server installation
After the Apache server is downloaded, decompress it. 1. Download the installation package 2. Unzip the file to the directory you want to place it. Here I choose to put it in D:\Apache- 2.4.20 directory.
3.
Open the httpd.conf file (for example, under D:\Apache-2.4.20\Apache\conf)
①Modify the actual absolute installation directory of Apache:
Cannot have "/" or "\" at the end, because the directory configured later already has "/" or "\" at the beginning, as shown in the figure below (where "${SRVROOT}" refers to the defined SRVROOT path variable): (can be "/", or Can be "\").
If your port 80 is occupied (you can use the commandnetstat -an -o | findstr 80
under cmd), change port 80 to something else save.
Check whether the configuration file is legal:httpd -t
② Installation Apache's main service: With it, Apache can be started.
You can add the httpd.exe environment variable, then open the cmd window and enter: httpd -k install -n Apache
This command means to install the Apache service that can be hosted by Windows. The parameter behind "-n"
is the custom Windows service name. You can then use the Windows management service command. To manage the apache service, such as "net start/stop apache" (start/stop service). The service is installed. After completion, it will be automatically tested. If there is a problem, the window will prompt an error. At this time, please troubleshoot according to the error. Normal installation is completed as shown in the figure below:
Among them, Errors reported here must be corrected before the service can be started. It means "Errors reported here must be corrected before the service can be started."
4.Startup of the Apache server
After configuring the Apache server, we can start the server. There are three ways to start the Apache server under Windows.
1. Start using Windows
Open Computer Management and find the apache service item. After selecting it, right-click to select the corresponding operation (start, stop, restart)
2. Use the command line to start
httpd -k start: No detailed error message will be prompted.
httpd -k start -n apache: A detailed error message will be prompted. Change "apache" to your Apache service name, which can be found in the computer service.
httpd -k restart -n apachet:Restart.
net start apache: Use the Windows hosting service command.
3. Use the window of the Apache server itself to open
Find ApacheMonitor.exe in the bin directory, open
Double-click to run, desktop An icon will appear in the lower right corner. Double-click to open the window interface. You will see the following picture:
Click start on the left to start the apache service.
Supplementary sentence, it can be seen from this interface that it can manually control the opening and closing of the service. In order to save resources, when shutting down the Apache server, please click "Stop" to shut down the apache service. Of course, this service can also be turned off in Windows System Services (it is recommended to set it to manual).
The following picture shows the status of the service being successfully displayed:
Open the browser and enter http://localhost. If the following picture appears If the interface is displayed, the basic configuration of the Apache server is completed and the apache server is ready to run.
5.Uninstalling the Apache service
If you no longer want to use the Apache server software and want to uninstall it , Be sure to uninstall the apache service first, and then delete the installation file (Remember, if you delete the folder in the installation path directly, there will be residual files on the computer, which may cause unnecessary trouble), in the cmd command window , enter as follows (it is recommended to stop the service first and then delete it):
httpd -k uninstall or sc delete apache (apache is the service name of the Apache server).
At this point, the downloading, installation, startup and uninstallation of the Apache server are all completed.
Note: Regarding the purpose of each file under the Apache server, as shown below:
More Apache related knowledge, Please visit the Apache usage tutorial column!
The above is the detailed content of How to install Apache and start the site under Windows. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

To set up a CGI directory in Apache, you need to perform the following steps: Create a CGI directory such as "cgi-bin", and grant Apache write permissions. Add the "ScriptAlias" directive block in the Apache configuration file to map the CGI directory to the "/cgi-bin" URL. Restart Apache.

When the Apache 80 port is occupied, the solution is as follows: find out the process that occupies the port and close it. Check the firewall settings to make sure Apache is not blocked. If the above method does not work, please reconfigure Apache to use a different port. Restart the Apache service.

Apache connects to a database requires the following steps: Install the database driver. Configure the web.xml file to create a connection pool. Create a JDBC data source and specify the connection settings. Use the JDBC API to access the database from Java code, including getting connections, creating statements, binding parameters, executing queries or updates, and processing results.

There are 3 ways to view the version on the Apache server: via the command line (apachectl -v or apache2ctl -v), check the server status page (http://<server IP or domain name>/server-status), or view the Apache configuration file (ServerVersion: Apache/<version number>).

The steps to start Apache are as follows: Install Apache (command: sudo apt-get install apache2 or download it from the official website) Start Apache (Linux: sudo systemctl start apache2; Windows: Right-click the "Apache2.4" service and select "Start") Check whether it has been started (Linux: sudo systemctl status apache2; Windows: Check the status of the "Apache2.4" service in the service manager) Enable boot automatically (optional, Linux: sudo systemctl

To delete an extra ServerName directive from Apache, you can take the following steps: Identify and delete the extra ServerName directive. Restart Apache to make the changes take effect. Check the configuration file to verify changes. Test the server to make sure the problem is resolved.

How to view the Apache version? Start the Apache server: Use sudo service apache2 start to start the server. View version number: Use one of the following methods to view version: Command line: Run the apache2 -v command. Server Status Page: Access the default port of the Apache server (usually 80) in a web browser, and the version information is displayed at the bottom of the page.

Apache cannot start because the following reasons may be: Configuration file syntax error. Conflict with other application ports. Permissions issue. Out of memory. Process deadlock. Daemon failure. SELinux permissions issues. Firewall problem. Software conflict.
