Home Backend Development PHP Tutorial How to install apache

How to install apache

May 14, 2019 am 09:21 AM
apache

PHP cannot run without the support of a server. What is a server? In layman's terms, a server software is installed on a computer. This computer can be called a server. The server software and the computer's own operating system are two different things. The computer's own operating system can be Linux, Unix, Windows or MacOS. At the same time, the service software can also be Apache (PHP), Tomcat (java/jsp), IIS (asp).

Recommended courses: PHP Tutorial.

How to install apache

PHP mainly uses the Apache server. The mainstream site construction combination is LAMP (Linux, Apache, MySQL, PHP). The integrated server software under Windows is WAMP (Windows , Apache, MySQL, PHP). In addition, there are some other PHP server software, such as lighttpd in Germany and nginx in Russia.

In my study, I mainly used the Apache server, so here I mainly talk about the download and installation of the Apache service.

(1)apache official website download Apache HTTP Server server

I believe that some friends want to download from the official website when they first use apache server, but facing the official website There are so many projects, images, and directories on the Internet that you may be a little confused. The following are the specific steps:

①Open the apache official website http://www.apache.org/ ​

②Click Download in the upper right corner, the following interface will appear, here are the mirror servers, Just find one, the recommended version is used here.

③A directory list appears. These are apache's project lists. I don't understand why apache browses in this way. It's so ugly.

④Click "httpd", the following interface will appear

⑤Click the red box, the following interface will appear

⑥After entering the following interface , select the first item ApacheHaus, which is a third-party download platform. Downloading independent Apache from its website will be a compressed package. Among the other four, the second one is also an independent Apache download address, and the other three are integrated development environments. The first one I chose.

⑦In the new interface, you will find the words VC9 and VC11. By reading the relevant content, you know that VC9 refers to the code compiled with VS2008, while VC11 is compiled with VS2012, and VS2012 The compiled version cannot be used in Windows XP and Server 2003. For the sake of better compatibility, I chose 32-bit Apache compiled with VC9. I chose to download it here and the download process is complete!

(2) Installation of Apache server

After downloading the Apache server, 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.

Note: The name of Apache24 can be changed according to your own situation. I changed it to "Apache" as follows:

(3) Apache server configuration

Open the httpd.conf file (under D:\Apache-2.4.20\Apache\conf, this is mine. If the location is different, then The file location is different)

① Modify the directory location, as shown below:

If your port 80 is occupied (you can use the command netstat under cmd -a view), change port 80 to something else and save it.

② Configure and install the main service of Apache. With it, Apache can be started. Open the cmd window and enter: "D:\Apache-2.4.20\Apache\bin\httpd.exe" -k install -n apache, remember to include the quotation marks . The meaning of this command is to install the apache service, name the service as apache (you can also change it to something else), and press Enter.

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 below:

Among them, Errors reported here must be corrected before the service can be started. Meaning, report here Errors must be corrected before service begins. If not, success.

(4) Starting 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. Start using the command line

I don’t know why I can’t start using the command line. The screenshot is as follows:

3. Use the Apache server Open your own window

Find ApacheMonitor.exe in the bin directory, open

Double-click to run, an icon will appear in the lower right corner of the desktop, double-click to open the window interface, You will see something like the picture below:

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. More specific configurations need to be understood by the user.​

The above is the detailed content of How to install apache. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to set the cgi directory in apache How to set the cgi directory in apache Apr 13, 2025 pm 01:18 PM

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.

How to start apache How to start apache Apr 13, 2025 pm 01:06 PM

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

What to do if the apache80 port is occupied What to do if the apache80 port is occupied Apr 13, 2025 pm 01:24 PM

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.

How Debian improves Hadoop data processing speed How Debian improves Hadoop data processing speed Apr 13, 2025 am 11:54 AM

This article discusses how to improve Hadoop data processing efficiency on Debian systems. Optimization strategies cover hardware upgrades, operating system parameter adjustments, Hadoop configuration modifications, and the use of efficient algorithms and tools. 1. Hardware resource strengthening ensures that all nodes have consistent hardware configurations, especially paying attention to CPU, memory and network equipment performance. Choosing high-performance hardware components is essential to improve overall processing speed. 2. Operating system tunes file descriptors and network connections: Modify the /etc/security/limits.conf file to increase the upper limit of file descriptors and network connections allowed to be opened at the same time by the system. JVM parameter adjustment: Adjust in hadoop-env.sh file

How to delete more than server names of apache How to delete more than server names of apache Apr 13, 2025 pm 01:09 PM

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 use Debian Apache logs to improve website performance How to use Debian Apache logs to improve website performance Apr 12, 2025 pm 11:36 PM

This article will explain how to improve website performance by analyzing Apache logs under the Debian system. 1. Log Analysis Basics Apache log records the detailed information of all HTTP requests, including IP address, timestamp, request URL, HTTP method and response code. In Debian systems, these logs are usually located in the /var/log/apache2/access.log and /var/log/apache2/error.log directories. Understanding the log structure is the first step in effective analysis. 2. Log analysis tool You can use a variety of tools to analyze Apache logs: Command line tools: grep, awk, sed and other command line tools.

How to connect to the database of apache How to connect to the database of apache Apr 13, 2025 pm 01:03 PM

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.

How to view your apache version How to view your apache version Apr 13, 2025 pm 01:15 PM

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>).

See all articles