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 analyze how to configure Apache Service in linux system

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Today, I will talk to you about how to analyze the configuration of Apache services in the linux system. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.

1. Back up the main configuration file of the Apache service

[root@KCentOS5C ~] # cp / etc/httpd/conf/httpd.conf / etc/httpd/conf/httpd.conf.backup

Main configuration file for configuring Apache service in 2.linux system

[root@KCentOS5C ~] # vi / etc/httpd/conf/httpd.conf

The following parameters are mainly changed here:

ServerName *: 80

Configure the server name of Apache, if there is a domain name, please fill in the correct server name.

Include conf.d/*.conf (/ etc/httpd/conf.d)

Confirm the path where the Apache extension configuration file is stored.

3. View the Nagios page configuration template file

[root@KCentOS5C ~] # less nagios-2.9/sample-config/httpd.conf

# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER

# Last Modified: 11-26-2005

#

# This file contains examples of entries that need

# to be incorporated into your Apache web server

# configuration file. Customize the paths, etc. As

# needed to fit your system.

# setting for nagios

ScriptAlias / nagios/cgi-bin "/ usr/local/nagios/sbin" # # sets the system path corresponding to the CGI execution directory of Nagios.

# SSLRequireSSL

Options ExecCGI

AllowOverride None

Order allow,deny

Allow from all

# Order deny,allow

# Deny from all

# Allow from 127.0.0.1

AuthName "Nagios Access"

AuthType Basic

AuthUserFile / usr/local/nagios/etc/htpasswd.user # # access to user account library files is specified here.

Require valid-user

Alias / nagios "/ usr/local/nagios/share" # # sets the system path corresponding to the web page URL of Nagios.

# SSLRequireSSL

Options None

AllowOverride None

Order allow,deny

Allow from all

# Order deny,allow

# Deny from all

# Allow from 127.0.0.1

AuthName "Nagios Access"

AuthType Basic

AuthUserFile / usr/local/nagios/etc/htpasswd.user # # access to user account library files is specified here

Require valid-user

{# add # setting for nagios-this paragraph to the end of / usr/local/apache/conf/httpd.conf.

Check the configuration with / usr/local/apache/bin/apachctl configtest-help View #}

Basically, this file can be used directly. According to the AuthUserFile entry specified in this configuration file, it specifies the account list library file for legitimate users who access Nagios through Apache, and you need to use the htpasswd command to add users to this list library. In the default installation environment, there is no htpasswd.user file in the / usr/local/nagios/etc/ directory, so you need to add it manually. In particular, please note that the permissions of htpasswd.user files created as root should be changed to the ownership of the nagios user nagios group immediately after the file is created, and read and write permissions for Nagios users in the same group should be increased.

4. Integrate Nagios web page configuration files into Apache

Copy the Nagios web page profile as an extended profile for Apache and rename it to the Apache extended profile directory / etc/httpd/conf.d/ directory

[root@KCentOS5C ~] # cp nagios-2.9/sample-config/httpd.conf / etc/httpd/conf.d/nagios-httpd.conf

5. Set up the Nagios web page access user account file (here must be consistent with the path file name specified by AuthUserFile in the Nagios web page configuration file)

[root@KCentOS5C ~] # touch / usr/local/nagios/etc/htpasswd.user

6. Change the owner of the Nagios web page access user account file

[root@KCentOS5C ~] # chown nagios.nagios / usr/local/nagios/etc/htpasswd.user

7. Add read and write permissions for members of the same group to Nagios web page access user account files (this is mainly assigned to apache system users)

[root@KCentOS5C ~] # chmod g+wr / usr/local/nagios/etc/htpasswd.user

8. View the property information of the Nagios web page to access the user account file

[root@KCentOS5C ~] # ll / usr/local/nagios/etc/htpasswd.user

-rw-rw-r-- 1 nagios nagios 0 Oct 5 14:05 / usr/local/nagios/etc/htpasswd.user

9. Add htpasswd.user user

I added a kanecruise user with a password of 123456.

[root@KCentOS5C] # htpasswd-m / usr/local/nagios/etc/htpasswd.user kanecruise

New password: 123456

Re-type new password: 123456

Adding password for user kanecruise

10.

[root@KCentOS5C ~] # htpasswd

Usage:

Htpasswd [- cmdpsD] passwordfile username

Htpasswd-b [cmdpsD] passwordfile username password

Htpasswd-n [mdps] username

Htpasswd-nb [mdps] username password

◆-c Create a new file.

Create a new account library file.

◆-n Don't update file; display results on stdout.

◆-m Force MD5 encryption of the password.

Add a new user whose MD5 password is encrypted.

◆-d Force CRYPT encryption of the password (default).

◆-p Do not encrypt the password (plaintext).

Add a new user whose password is not encrypted.

◆-s Force SHA encryption of the password.

Add a new user whose SHA password is encrypted.

◆-b Use the password from the command line rather than prompting for it.

◆-D Delete the specified user.

Delete a specified user

On Windows, NetWare and TPF systems the'- m 'flag is used by default.

The "- m" parameter (enabling MD5 password encryption) is used by default in Windows, NetWare, and TPF operating systems.

On all other systems, the'- p 'flag will probably not work.

In all other operating systems, the "- p" (do not enable encryption for passwords) parameter may cause failure.

11. Check the htpasswd account file

[root@KCentOS5C ~] # cat / usr/local/nagios/etc/htpasswd.user

Kanecruise:$apr1 $Qwk9h/..$HaRakpabADGZL10dwPcrx1

The user adds it correctly, and the passwords are encrypted as MD5.

The above explanation is to configure Apache services in a linux system.

After reading the above, do you have any further understanding of how to analyze the configuration of Apache services in linux systems? If you want to know more knowledge or related content, 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