Table of Contents
Nginx下10个安全问题提示,nginx10安全问题
Home Backend Development PHP Tutorial Nginx下10个安全问题提示,nginx10安全问题_PHP教程

Nginx下10个安全问题提示,nginx10安全问题_PHP教程

Jul 12, 2016 am 09:00 AM
nginx Down Safety hint yes question

Nginx下10个安全问题提示,nginx10安全问题

Nginx是当今最流行的Web服务器之一。
它为世界上7%的web流量提供服务而且正在以惊人的速度增长。它是个让人惊奇的服务器,我愿意部署它 下面是一个常见安全陷阱和解决方案的列表,它可以辅助来确保你的Nginx部署是安全的。    1. 在配置文件中小心使用"if"。它是重写模块的一部分,不应该在任何地方使用。  “if”声明是重写模块评估指令强制性的部分。换个说法,Nginx的配置一般来说是声明式的。在有些情况下,由于用户的需求,他们试图在一些非重写指令内使用“if”,这导致我们现在遇到的情况。大多数情况下都能正常工作,但…看上面提到的。  看起来唯一正确的解决方案是在非重写的指令内完全禁用“if”。这将更改现有的许多配置,所以还没有完成。  来源: IfIsEvil    2. 将每个~ .php$请求转递给PHP。 上周发布了这个流行指令的潜在安全漏洞介绍。即使文件名为hello.php.jpeg它也会匹配~ .php$这个正则而执行文件。 现在有两个解决上述问题的好方法。我觉得确保你不轻易执行任意代码的混合方法很有必要。  1.如果没找到文件时使用try_files和only(在所有的动态执行情况下都应该注意) 将它转递给运行PHP的FCGI进程。  2.确认php.ini文件中cgi.fix_pathinfo设置为0 (cgi.fix_pathinfo=0) 。这样确保PHP检查文件全名(当它在文件结尾没有发现.php它将忽略)   3.修复正则表达式匹配不正确文件的问题。现在正则表达式认为任何文件都包含".php"。在站点后加“if”确保只有正确的文件才能运行。将/location ~ .php$和location ~ ..*/.*.php$都设置为return 403;  3. 禁用autoindex模块。   这个可能在你使用的Nginx版本中已经更改了,如果没有的话只需在配置文件的location块中增加autoindex off;声明即可。 4. 禁用服务器上的ssi (服务器端引用)。这个可以通过在location块中添加ssi off; 。(脚本学堂 www.jbxue.com) 5. 关闭服务器标记。如果开启的话(默认情况下)所有的错误页面都会显示服务器的版本和信息。将server_tokens off;声明添加到Nginx配置文件来解决这个问题。    6. 在配置文件中设置自定义缓存以限制缓冲区溢出攻击的可能性。
client_body_buffer_size  1K; 
client_header_buffer_size 1k; 
client_max_body_size 1k; 
large_client_header_buffers 2 1k; 
Copy after login
7. 将timeout设低来防止DOS攻击。所有这些声明都可以放到主配置文件中。
client_body_timeout   10; 
client_header_timeout 10; 
keepalive_timeout     5 5; 
send_timeout          10; 
Copy after login
8. 限制用户连接数来预防DOS攻击。
limit_zone slimits $binary_remote_addr 5m; 
limit_conn slimits 5;  
Copy after login
9. 试着避免使用HTTP认证。HTTP认证默认使用crypt,它的哈希并不安全。如果你要用的话就用MD5(这也不是个好选择但负载方面比crypt好) 。 10. 保持与最新的Nginx安全更新。 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1092001.htmlTechArticleNginx下10个安全问题提示,nginx10安全问题 Nginx是当今最流行的Web服务器之一。 它为世界上7%的web流量提供服务而且正在以惊人的速度增长。...
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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
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)

How should the Java framework security architecture design be balanced with business needs? How should the Java framework security architecture design be balanced with business needs? Jun 04, 2024 pm 02:53 PM

Java framework design enables security by balancing security needs with business needs: identifying key business needs and prioritizing relevant security requirements. Develop flexible security strategies, respond to threats in layers, and make regular adjustments. Consider architectural flexibility, support business evolution, and abstract security functions. Prioritize efficiency and availability, optimize security measures, and improve visibility.

Security configuration and hardening of Struts 2 framework Security configuration and hardening of Struts 2 framework May 31, 2024 pm 10:53 PM

To protect your Struts2 application, you can use the following security configurations: Disable unused features Enable content type checking Validate input Enable security tokens Prevent CSRF attacks Use RBAC to restrict role-based access

Implementing Machine Learning Algorithms in C++: Security Considerations and Best Practices Implementing Machine Learning Algorithms in C++: Security Considerations and Best Practices Jun 01, 2024 am 09:26 AM

When implementing machine learning algorithms in C++, security considerations are critical, including data privacy, model tampering, and input validation. Best practices include adopting secure libraries, minimizing permissions, using sandboxes, and continuous monitoring. The practical case demonstrates the use of the Botan library to encrypt and decrypt the CNN model to ensure safe training and prediction.

PHP Microframework: Security Discussion of Slim and Phalcon PHP Microframework: Security Discussion of Slim and Phalcon Jun 04, 2024 am 09:28 AM

In the security comparison between Slim and Phalcon in PHP micro-frameworks, Phalcon has built-in security features such as CSRF and XSS protection, form validation, etc., while Slim lacks out-of-the-box security features and requires manual implementation of security measures. For security-critical applications, Phalcon offers more comprehensive protection and is the better choice.

Which wallet is safer for SHIB coins? (Must read for newbies) Which wallet is safer for SHIB coins? (Must read for newbies) Jun 05, 2024 pm 01:30 PM

SHIB coin is no longer unfamiliar to investors. It is a conceptual token of the same type as Dogecoin. With the development of the market, SHIB’s current market value has ranked 12th. It can be seen that the SHIB market is hot and attracts countless investments. investors participate in investment. In the past, there have been frequent transactions and wallet security incidents in the market. Many investors have been worried about the storage problem of SHIB. They wonder which wallet is safer for SHIB coins at the moment? According to market data analysis, the relatively safe wallets are mainly OKXWeb3Wallet, imToken, and MetaMask wallets, which will be relatively safe. Next, the editor will talk about them in detail. Which wallet is safer for SHIB coins? At present, SHIB coins are placed on OKXWe

How to enhance the security of Spring Boot framework How to enhance the security of Spring Boot framework Jun 01, 2024 am 09:29 AM

How to Enhance the Security of SpringBoot Framework It is crucial to enhance the security of SpringBoot applications to protect user data and prevent attacks. The following are several key steps to enhance SpringBoot security: 1. Enable HTTPS Use HTTPS to establish a secure connection between the server and the client to prevent information from being eavesdropped or tampered with. In SpringBoot, HTTPS can be enabled by configuring the following in application.properties: server.ssl.key-store=path/to/keystore.jksserver.ssl.k

WordPress site file access is restricted: Why is my .txt file not accessible through domain name? WordPress site file access is restricted: Why is my .txt file not accessible through domain name? Apr 01, 2025 pm 03:00 PM

Wordpress site file access is restricted: troubleshooting the reason why .txt file cannot be accessed recently. Some users encountered a problem when configuring the mini program business domain name: �...

How C++ technology promotes software security and reliability How C++ technology promotes software security and reliability Jun 02, 2024 pm 02:54 PM

C++ technology ensures software safety and reliability in the following ways: Strong type system: Prevents type conversion errors. Memory management: Fine-grained control to avoid memory leaks and corruption. Exception handling: Handle errors gracefully and maintain robustness. RAII (resource acquisition is initialization): automatically manages resources and improves reliability. Templates: Generic programming, reducing duplicate code and errors.

See all articles