About Nginx support. Analysis of Htaccess

Source: Internet
Author: User

Http://www.40099.cc/funny/184.html

Previous discussions with Wang Yi in the Typecho development Group about Nginx support for. htaccess files. Wang Yi that Nginx can support. htaccess rules, and is compatible with Apache rules. I think Nginx supports using. htaccess files to store nginx pseudo-static rules, incompatible. htaccess rules.

I said that for a reason, I consulted the Nginx official documentation document 1/Document 2, Document 1 is the Nginx rewrite module of the doc, detailed explanation of nginx rewrite rule composition, in which I did not find the rules about Apache, in document 2 , the documentation explains why you do not use the. htaccess file and compares Nginx to Apache. As we all know, Nginx does not support. htaccess rules, open source China's webmaster sweet potato once sent an article: Who says Nginx does not support. htaccess, in my opinion, the sweet potato is in the confusion, the concept of the substitution, we say is. htaccess rules, and sweet potatoes are said to be. htaccess files.

Said so much nonsense. Next I analyze why Nginx does not support. htaccess, mainly in the following aspects.

1. Performance requirements: In document 2 we can know that Apache processing pseudo-static rules will be in turn search each directory of the. htaccess file, which will result in a large number of queries, impact performance, and Nginx design concept does not match.

2. Software mode decision: Apache design is dynamic loading this point, can be processed from Apache. htaccess file. You have modified the. htaccess, you can immediately take effect, including the Apache loading module is also dynamic loading, and nginx is the rule of writing dead, modify the need to overload Nginx. Tengine Although a dynamic load module is provided, it is necessary to overload the settings to take effect, which can be said in the " Pseudo-Dynamic ".

3. North Bears's self-esteem: Apache behind the figure of the United States http://www.40099.cc/life/183.html, bears feel that if compatible with a bit humble. So make your own version.

The feasibility analysis of the. htaccess applied to Nginx. In my opinion,. htaccess cannot be applied to the commercialization of the LNMP platform. There are several main reasons for this:

1. Low security.

Because Nginx is to load the configuration file before running, so if you use the virtual host has a love tossing the neighbor, in case the guy's hands are broken, changed the wrong, you will not be able to access, and then suffer.

2. Inconvenient operation.

Nginx because it is loaded in the configuration file, so after each modification needs to restart Nginx, do you give the user SSH password to facilitate their restart? If you do not use exec in PHP for your password, there is a risk of cross-site. If Chroot,exec is turned on, there is no effect.

Summary: In fact Nginx does not only support. htaccess files, you can even use the. mp3 to put pseudo-static rules. However, for security reasons, I recommend that you use the default conf file to save the rewrite rule. After all, perhaps the day the hands of the cheap to empty the directory, the rules are gone. And so the nginx crashes.

About Nginx support. Analysis of Htaccess

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.