Table of Contents
1、以Nobody用户运行
3、SSI的配置
4、阻止用户修改系统设置
5、改变Apache 服务器的缺省访问特性
6、CGI脚本的安全考虑
7、SSL链接加密
Home Backend Development PHP Tutorial PHP安全性之apache server安全性设置

PHP安全性之apache server安全性设置

Jun 20, 2016 pm 01:02 PM
Website security

PHP安全性漫谈之apache server安全性设置

1、以Nobody用户运行

一般情况下,Apache是由Root 来安装和运行的。如果Apache Server进程具有Root用户特权,那么它将给系统的安全构成很大的威胁,应确保Apache Server进程以最可能低的权限用户来运行。通过修改httpd.conf文件中的下列选项,以Nobody用户运行Apache 达到相对安全的目的。

User nobody
Group# -1
Copy after login


2、ServerRoot目录的权限

为了确保所有的配置是适当的和安全的,需要严格控制Apache 主目录的访问权限,使非超级用户不能修改该目录中的内容。Apache 的主目录对应于Apache Server配置文件httpd.conf的Server Root控制项中,应为:
Server Root /usr/local/apache

3、SSI的配置

在配置文件access.conf 或httpd.conf中的确Options指令处加入Includes NO EXEC选项,用以禁用Apache Server 中的执行功能。避免用户直接执行Apache 服务器中的执行程序,而造成服务器系统的公开化。

Options Includes Noexec

4、阻止用户修改系统设置

在Apache 服务器的配置文件中进行以下的设置,阻止用户建立、修改 .htaccess文件,防止用户超越能定义的系统安全特性。

AllowOveride None
Options None
Allow from all
Copy after login



然后再分别对特定的目录进行适当的配置。

5、改变Apache 服务器的缺省访问特性

Apache 的默认设置只能保障一定程度的安全,如果服务器能够通过正常的映射规则找到文件,那么客户端便会获取该文件,如http://local host/~ root/ 将允许用户访问整个文件系统。在服务器文件中加入如下内容:

order deny,ellow
Deny from all
Copy after login



将禁止对文件系统的缺省访问。

6、CGI脚本的安全考虑

CGI脚本是一系列可以通过Web服务器来运行的程序。为了保证系统的安全性,应确保CGI的作者是可信的。对CGI而言,最好将其限制在一个特定的目 录下,如cgi-bin之下,便于管理;另外应该保证CGI目录下的文件是不可写的,避免一些欺骗性的程序驻留或混迹其中;如果能够给用户提供一个安全性 良好的CGI程序的模块作为参考,也许会减少许多不必要的麻烦和安全隐患;除去CGI目录下的所有非业务应用的脚本,以防异常的信息泄漏。

7、SSL链接加密

以上这些常用的举措可以给Apache Server 一个基本的安全运行环境,显然在具体实施上还要做进一步的细化分解,制定出符合实际应用的安全配置方案。


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1273
29
C# Tutorial
1255
24
php CodeIgniter Security Guide: Protect your website from attacks php CodeIgniter Security Guide: Protect your website from attacks Feb 19, 2024 pm 06:21 PM

1. Use the latest version of CodeIgniter The CodeIgniter team regularly releases security patches and updates to fix known vulnerabilities. Therefore, it is important to ensure that you are always using the latest version of CodeIgniter. You can download the latest version by visiting CodeIgniter’s official website. 2. Enforce the use of secure connections (HTTPS) https can encrypt the data passed between your website and users, making it more difficult for malicious users to intercept and steal. You can enable HTTPS by installing an SSL certificate on your server. 3. Avoid using default configurations CodeIgniter provides many default configurations to simplify the development process. However, these default configurations may not

Website security development practices: How to prevent XML external entity attacks (XXE) Website security development practices: How to prevent XML external entity attacks (XXE) Jun 29, 2023 am 08:51 AM

Website Security Development Practice: How to Prevent XML External Entity Attacks (XXE) With the development of the Internet, websites have become an important way for people to obtain and share information. However, the risks that come with it are also increasing. One of them is XML External Entity Attack (XXE), which is an attack method that exploits vulnerabilities in XML parsers. In this article, we will explain what an XXE attack is and how to prevent it. 1. What is XML External Entity Attack (XXE)? XML external entity attack (XXE) is a

Website security development practices: How to prevent SSRF attacks Website security development practices: How to prevent SSRF attacks Jun 29, 2023 am 11:58 AM

Website Security Development Practice: How to Prevent SSRF Attacks With the rapid development of the Internet, more and more companies and individuals choose to move their business to the cloud, and website security issues have also attracted increasing attention. One of the common security threats is SSRF (Server-SideRequestForgery, server-side request forgery) attack. This article will introduce the principles and harms of SSRF attacks, and provide some common preventive measures to help developers strengthen the security of their websites. The principles and dangers of SSRF attacks

Using ThinkPHP6 to implement website security detection Using ThinkPHP6 to implement website security detection Jun 20, 2023 am 09:03 AM

With the continuous development of the Internet, more and more websites have emerged, but at the same time, website security problems have become more and more serious. Security vulnerabilities such as hacker attacks, malware, and SQL injection cause headaches for website operators. In order to ensure the security of the website, security testing during website construction and operation is also particularly important. This article will introduce how to use ThinkPHP6 to implement website security detection and help website operators further improve website security. 1. What is ThinkPHP6? ThinkPHP6 is a PH

Detailed explanation of the impact of Discuz canceling the verification code function on website security Detailed explanation of the impact of Discuz canceling the verification code function on website security Mar 11, 2024 am 10:45 AM

"Discussion on the Impact of Discuz's Canceling the Verification Code Function on Website Security" With the rapid development of the Internet, website security issues have become increasingly prominent. As a common security verification mechanism, verification code is widely used on websites. However, some websites may cancel the verification code function in order to improve user experience. Will this have a negative impact on website security? This article will discuss the impact of Discuz's cancellation of verification code function on website security and provide specific code examples. 1. The function and principle of verification code Verification code (CAP)

Use Pagoda Panel for HTTPS upgrade to improve website security Use Pagoda Panel for HTTPS upgrade to improve website security Jun 21, 2023 am 10:15 AM

With the development of the Internet, websites have become an important channel for enterprises to display their image and communicate with the outside world. However, the network security issues that come with it are indeed worrying. Many website administrators may already be aware of the importance of protecting user data and transaction information by using the HTTPS protocol, but may not yet have a good understanding of how to implement HTTPS upgrades. This article will introduce how to use the Pagoda Panel to upgrade HTTPS and improve the security of the website. 1. What is HTTPS? HTTP is Hypertext Transfer Protocol, a

PHP Firewall Implementation: Website Security Architecture Design Guide PHP Firewall Implementation: Website Security Architecture Design Guide Jun 30, 2023 pm 06:57 PM

Website Security Architecture Design Guide: Implementation of PHP Firewall Introduction: In today's Internet era, website security problems are becoming increasingly serious. Hackers are constantly using loopholes to invade websites, steal user information or disrupt the normal operation of the website. In order to protect the privacy and security of the website and its users, it is crucial to establish a reliable security architecture. This article will focus on the implementation of PHP firewall and provide guidance for website security architecture. 1. What is a PHP firewall? The PHP firewall is a security measure that blocks malicious attacks and intrusions by filtering

PHP website security and protection measures PHP website security and protection measures May 04, 2024 pm 10:48 PM

PHP website security measures include: Preventing SQL injection: using prepared statements or escaping user input. Prevent XSS: Escape user input. Prevent CSRF: Use CSRF tokens. Prevent buffer overflow: Set the maximum input length. Stay updated, use security frameworks, enable firewalls, monitor websites, conduct security audits.

See all articles