Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install apache in Linux

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly analyzes the relevant knowledge points of how to install apache in Linux, the content is detailed and easy to understand, the operation details are reasonable, and has a certain reference value. If you are interested, you might as well follow the editor to have a look, and follow the editor to learn more about how to install apache in Linux.

Generally speaking, Linux systems have their own apache version, but when starting with this built-in version, there will be various problems such as port occupation. Because the built-in apache version is relatively low, first check whether there is a lower version of apache installed in Linux, and if so, uninstall it before installing it. The Linux used by the editor is the CentOS6.5 version.

Uninstall the software packages already installed by apache

1. Command rpm-qa | grep httpd to view the list of all apache packages installed in the system

2, uninstall the software package, uninstall the software one by one from the bottom to the top. If the user cannot uninstall the software, you can add sudo before the command (sudo is a linux system management instruction, a tool that allows system administrators to allow ordinary users to execute some or all of the root commands).

Uninstall using the rpm-e-nodeps httpd command, and-nodeps means ignoring dependencies when uninstalling the software. It is not necessary to write the full name of the package when uninstalling, just write the name of the package, such as httpd or httpd-tools

3. Check whether apache has been uninstalled. The following indicates that it has been uninstalled.

Second, install apache (yum source installation)

1. Use yum install httpd to install directly

2. After the installation is complete, use rpm-qa | grep httpd to check whether apache has been installed successfully.

3. Then start apache with the command: service httpd start

If the following prompt appears at startup

So in vim / etc/httpd/conf/httpd.conf

Find # ServerName www.example.com:80, change it to ServerName localhost:80,localhost or change it to the corresponding IP address

Check whether the httpd.conf is correct with httpd-t

Then restart apache, and you won't make a mistake.

4. Set boot self-boot: chkconfig httpd on

Third, install apache through the yum source where commonly used files are stored.

(1) the configuration file is located in the / etc/httpd directory by default

/ etc/httpd/conf.d: set the parameter information of apache by yourself. The file in it should end with xxx.conf. When apache starts, this file will be automatically read into the main configuration file.

/ etc/httpd/modules: the module that stores the httpd

/ etc/httpd/log: record all logs of apache

Enter the cd conf directory, / etc/httpd/conf/httpd.conf: the file that configures the main permissions and functions of Apache, which is the most important configuration file

(2) etc/init.d/httpd: startup file

(3) the files that store web pages are stored in the / var/www directory by default.

/ var/www/html: the directory where the home file is stored (the default directory DocumentRoot=/var/www/html in / etc/httpd/conf/httpd.conf)

/ var/www/error: file for error message handling (error setting of host or data error required by browser client, error message displayed on browser)

/ var/www/icons: store the pictures of (apache, tomcat) web pages

/ var/www/cgi-bin: stores executable CGI (web program) programs

(4) / var/log/httpd/access_log: access Apache log files by default

(5) / var/log/httpd/error_log: error log file

(6) / usr/sbin/apachectl: this apachectl is a file and the main execution file of apache. It can actively detect some settings on the system, making it easier to start apache, which is equivalent to some management tools of apache.

(7) / usr/bin/htpasswd: when you log on to the web page, you will be prompted to enter your account number and password, and apache itself provides the most basic password protection, and the password is generated through this instruction.

This is the end of the introduction on "how to install apache in Linux". More related content can be searched for previous articles, hoping to help you answer questions and questions, please support the website!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report