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

The installation and configuration method of Apache under CentOS7

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

Share

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

I installed Nginx a few days ago. I installed Apache,Apache again for fun. The installation was smooth. I would like to make some study records and experience sharing here.

First, install httpd

1. First check to see if the system has been installed with httpd. If nothing is found, it is not installed. If there is a rpm registration found in # rpm-e, you can delete it.

# rpm-qa | grep httpd

2. Here I directly use yum to install (will automatically install dependent packages), for simplicity and convenience.

Yum-y install httpd

3. Httpd-v check the installation version. After the installation is successful, look for the location of the configuration file and configure httpd.

# find /-name "httpd.conf"

4. Of course, it is best to back up the original configuration file, such as:

# cp / etc/httpd/conf/httpd.conf / etc/httpd/conf/httpd.conf.origin

Second, configure Apache files

1. Pay special attention to this configuration, which is a new default value of Apache 2.4. reject all requests!

AllowOverride none Require all denied

Change none to ALL, centos uses vi or vim to edit, enter / query content in instruction mode, enter, you can find the content, and then modify it. (vim find tutorial: http://jingyan.baidu.com/article/219f4bf793a0c2de442d38f1.html)

2. Configure WEB site

If my site page file is the default

Listen 8080 DocumentRoot "/ var/www/html" ServerName localhost:8080 AllowOverride All Options FollowSymLinks Includes ExecCGI Require all granted

3. Add firewall port

I am using centos7's default firewall firewall, adding port 8080.

# firewall-cmd-- permanent-- zone=public-- add-port=8080-8081/tcp-- permanently add port # fire-cmd-- permanent-- zone=public-- list-ports-- View the opener # systemctl restart firewalld.service / / you need to restart the service for it to take effect after modifying the configuration

Of course, if you use a cloud server, you also need to add port support to the console (I talked about this in the installation and configuration of mysql).

4. Test

Enter 192.168.x.x:8080/index.html in your window browser to parse the html file in the server path.

Summary

The above is the method of installation and configuration of Apache under CentOS7 introduced by the editor. I hope it will be helpful to you. If you have any questions, you are welcome to leave a message, and the editor will reply you in time!

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