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 for centos7

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

How to install apache for centos7? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.

Apache HTTP server is the most popular Web server in the world. It is a free open source and cross-platform HTTP server that provides powerful features and can be extended through a variety of modules. The following instructions describe how to install and manage an Apache Web server on a CentOS 7 machine.

Install Apache

Apache is available in the default CentOS repository and is easy to install. On CentOS and RHEL, Apache packages and services are called httpd. To install the package, run the following command:

Sudo yum install httpd

After the installation is complete, enable and start the Apache service:

Sudo systemctl enable httpdsudo systemctl start httpd

If you are running a firewall, you also need to open HTTP and HTTPS ports 80 and 443:

Sudo firewall-cmd-permanent-zone=public-add-service=httpsudo firewall-cmd-permanent-zone=public-add-service=httpssudo firewall-cmd-reload

We can check the status and version of the Apache service in the following ways:

Sudo systemctl status httpd

Output:

Httpd.service-The Apache HTTP Server Loaded: loaded (/ usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2018-04-26 07:13:07 UTC; 11s ago Docs: man:httpd (8) man:apachectl (8) Main PID: 3049 (httpd) Status: "Total requests: 0; Current requests/sec: 0 Current traffic: 0 B/sec "CGroup: / system.slice/httpd.service ├─ 3049 / usr/sbin/httpd-DFOREGROUND ├─ 3050 / usr/sbin/httpd-DFOREGROUND ├─ 3051 / usr/sbin/httpd-DFOREGROUND ├─ 3052 / usr/sbin/httpd-DFOREGROUND ├─ 3053 / usr/sbin/httpd-DFOREGROUND └─ 3054 / usr/sbin/httpd-DFOREGROUNDsudo httpd-v

Output:

Server version: Apache/2.4.6 (CentOS) Server built: Oct 19 2017 20:39:16

Finally, to verify the installation, open your server IP address http://YOUR_IP in the browser of your choice

Use systemctl to manage Apache services

We can manage Apache services like any other system unit.

To stop the Apache service, run:

Sudo systemctl stop httpd

To start again, type:

Sudo systemctl start httpd

Restart the Apache service:

$sudo systemctl restart httpd

Reload the Apache service after making some configuration changes:

$sudo systemctl reload httpd

If you want to disable the Apache service to start at startup:

$sudo systemctl disable httpd

And re-enable it:

Will sudo systemctl enable httpd be helpful to you after reading the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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

Servers

Wechat

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

12
Report