Nginx in the use of pseudo static is directly in the nginx.conf write rules, do not need to be like Apache to open the Write module (mod_rewrite) in order to perform pseudo static.
Nginx only need to open the nginx.conf configuration file, write
Recently, I tried to configure and install a website on VPs. VPs installed lnmp (Linux + nginx + MySQL + PHP) and often encountered some problems during rule resetting, directly using Apache rules to nginx does not work. In the past, Apache rewrite
Apacherewrite redirection rules, rewrite regular expressions, second-level domain names point to first-level domain names, multiple domain names point to one domain name, IP to domain name first there is a linux server, there are four IP addresses
The use of pseudo-static in nginx directly writes rules in nginx. conf, and does not require pseudo-static operations like apache to enable the write module (mod_rewrite.Nginx only needs to open the nginx. conf configuration file and write the
I recently wrote a small example, you can see this first, there are small examples of the complete code download
Http://www.jb51.net/article/20906.htm
For a long time did not write technical articles, if you do not understand, see more than a few,
Nginx-rewrite regular expression matching
Case matching
~ to match case sensitivity~* for case-insensitive matching!~ and!~* are case insensitive and case-insensitive mismatches, respectively.
File and directory matching
-F and!-f are used to
Most common: Static addresses are redirected to dynamic addresses with parametersRewrite "^ (. *)/service/(. *) \.html$" $1/service.php?sid=$2 permanent;In turn: Dynamic addresses with parameters redirected to static addressesif ($query _string ~*
The main function of Rewirte is to implement a URL jump, and its regular expression is based on the Perl language. Can be based on both server-level (httpd.conf) and directory-level (. htaccess) methods. If you want to use the rewrite module, you
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.