Nginx pseudo-static configuration and common Rewrite pseudo-static rules, nginxrewrite
Pseudo-static is a way to change the file suffix to any possible one. If I want to convert the PHP file pseudo-static to an html file, this is quite simple, the following describes the nginx pseudo-static configuration method. For more information, see.
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 required rules in the server.
Server
{
Listen 80;
Server_name bbs.jb51.net;
Index index.html index.htm index. php;
Root/home/www/bbs;
Error_page 404/404 .htm; # configure the 404 error page
Location ~ . *. (Php | php5 )? $
{
# Fastcgi_pass unix:/tmp/php-cgi.sock;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fcinclude gi. conf;
}
# Below is the pseudo-static
Location /{
Rewrite ^ (. *)/equip(d00000000.html $1/index. php? M = content & c = index & a = lists & catid = $2 last;
}
Access_log off;
}
Then restart the nginx server and the pseudo-static state will take effect. This maintenance is inconvenient for us to write it in an external file such as bbs_nginx.conf.
Create the bbs_nginx.conf file in the/home/www/bbs directory and write the following code:
Ocation /{
Rewrite ^ (. *)/equip(d00000000.html $1/index. php? M = content & c = index & a = lists & catid = $2 last;
}
Add the following code after the above Code:
Include/home/www/bbs/bbs_nginx.conf;
In this way, the bbs_nginx.conf pseudo-static rules in the root directory of the website can be managed separately.