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 deploy Apache service under CentOS

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article introduces the knowledge of "how to deploy Apache services under CentOS". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Compile and install the development environment

Before compiling and installing, first yum installs "Development Environment", "compatible Library" and "Chinese support", that is, execute the following command

# yum groupinstall "Development tools"Compatibility libraries"Chinese Support [zh]"-y

Install man, vim, wget tools

# yum install man vim wget-y compile and install httpd

Because httpd2.4.25 is being compiled and installed this time, this version requires a later version of apr and apr-util.

So compile and install apr and apr-util first.

Wget http://mirrors.hust.edu.cn/apache/apr/apr-1.5.2.tar.bz2wget http://mirrors.hust.edu.cn/apache/apr/apr-util-1.5.4.tar.bz2 compile and install aprtar xf apr-1.5.2.tar.bz2cd apr-1.5.2./configure-- prefix=/usr/local/aprecho $? # if the result is 0 Then continue to execute make & & make install compilation and install apr-utiltar xf apr-util-1.5.4.tar.bz2cd apr-util-1.5.4./configure-- prefix=/usr/local/apr-util-- with-apr=/usr/local/aprecho $? # if the result is 0, continue to execute make & & make install and officially start compiling httpd-2.4.25wget http://mirrors.hust.edu.cn/apache/httpd/httpd-2.4.25.tar.bz2

According to many compiling experiences, lack of pcre-related files, openssl is too old

Execute the following command:

Yum install pcre-devel openssl openssl-devel-ytar xf httpd-2.4.25cd httpd-2.4.25./configure-prefix=/usr/local/apache-sysconfdir=/etc/httpd-with-apr=/usr/local/apr-with-apr-util=/usr/local/apr-util/

The method of compiling and installing Apache server on CentOS 6.5. (minimizing installation)

Continue as prompted above: make & & make install

Execute echo$? again If the result is 0, it means that httpd2.4.25 has been compiled successfully at this point, and then simply configured, you can use the

Configure httpd

Turn off linux Firewall

Service httpd stop

Close SELinux

Setenforce 0

Copy startup file

Cp / usr/local/apache/bin/apachectl / etc/init.d/httpd

Add the environment variable of httpd to the environment variable

Echo 'export PATH=$PATH:/usr/local/apache/bin' > / etc/profile.d/httpd.shchmod + x / etc/profile.d/httpd.shsource / etc/profile.d/httpd.sh

Edit the configuration file for httpd:

Vim / etc/httpd/httpd.conf

On the next line of ServerRoot, add ServerName localhost

If you want to add the Apache service to boot, you can modify the service startup script:

Vim / etc/init.d/httpd

Add under the second line:

# chkconfig:235 85 15 # description: This is apache server

Save exit

Execute a command

Service httpd start

# prompt that lynx can't find it? Then...

Yum install lynx-y

Execute a command

Netstat-ntlp

# check whether httpd is started, whether there is port 80 and finally enter the virtual machine IP address in your browser

It works!

Then Apache is installed successfully

1. Compile and install-the default index.html home page is at

/ usr/local/apache/htdocs

2. Configuration file:

/ etc/httpd/httpd.conf

3. Startup script:

/ etc/init.d/httpd

4. Cgi-bin file directory:

/ etc/local/apache/cgi-bin, "how to deploy Apache services under CentOS" ends here. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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