Lua sometimes has to ask for outside links, tried several ways to find the best performance in this way
location /set { default_type'text/html'; proxy_set_header Host test.yufei.com; proxy_connect_timeout 5s; proxy_send_timeout 3s; proxy_read_timeout 3s; proxy_pass http://test.yufei.com/api?a=$aaab=$bbb; } location /change { set$a''; set$b''; content_by_lua ' local time = os.date("%Y%m%d") local args
After searching and testing on the Internet, it is found that the rewrite rules of Nginx and the Rewite rules of Apache are not very different, and can be used almost directly. Like writing rules like this in Apache.
Rewrite ^/([0-9]{5}). html$/viewthread.php?tid=$1 last;
Writing in Nginx is impossible to
Wordpress
WordPress is still the world's most popular blog system, more and more by the WordPress built Web site in the use of Nginx Server Software, here to share the WordPress nginx rewrite rules:
server {Listen 80;
server_name www.jb51.net jb51.net;
Access_log/data/logs/nginx/www.jb51.net.access.lo
Nginx common pseudo-static rules (rewrite)-Discuz X3.2-WordPress-PHPCMS-ECSHOP-SHOPE (convert), nginx-discuz
When we switch from an apache server to an Nginx server, their pseudo-static rules are different. Therefore, you are familiar with the pseudo-static rules of the Nginx
First of all, http://nginx.org/download/download a version of the Nginx package that you need. Download using wget
If you need to redirect the installation of the corresponding package
Yum-y Install pcre*wget http://nginx.org/download/nginx-1.7.8.tar.gzAfter the download is complete, unpack the corresponding package.TAR-ZXVF nginx-1.7.8.tar.gz
Switch
Parameter problems of Nginx redirection
When writing rewrite redirection rules to a website, I encountered this parameter handling problem about redirection. By default, Nginx will automatically add the parameter portion of the old address after rewrite, which may be superfluous for the new address to redirect to. Wh
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 rules to nginx were not quite the same.
Here is just a simple record of
File name example.conf server {#监听的端口号Listen 80;
#域名
server_name www.example.com *.example.com; #指定目录某个目录的父目录, Root d:/www; #指定404页面 Error_page 404/404.php;
#location模块当其他都匹配不到的时候才匹配 '/'
#根目录下,location/{
#配置默认页
Index index.php
#nginx路由重写示例, if multiple files can be configured
re
: This article mainly introduces the Nginx study notes (2) -- rewrite in nginx. if you are interested in the PHP Tutorial, refer to it. The format is as follows:
Rewrite rge replement flagReplace the target flag with the rewrite regular expressionThe flag can be in the fo
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 the required rules in the server.
Copy Code code as follows:
Server
{
listen 80;
server_name bbs.jb51.net;
Index index.html index.
Run centos6.5 + lanmpapache as the backend and nginx as the front-end software: wordpressnginx virtual host configuration: server?listen80=server_namexxx.com?rootvarwwwxxxhtml#indexindex.htmlindex.htm index. php ;...
Centos 6.5 + lanmp
Apache is used as the backend and nginx is used as the front-end
Software: wordpress
The nginx virtual host configuration is as
Use the following code to jump to the specified server {code ...} now, if you want to get the IP address of the nginx server on the server to which you want to jump, the commonly used code for getting the nginx server does not seem to be available. Is there a way to get the IP address? Amp; lt ;? Php $ ip $ _ SERVER [ quot; REMOTE _... use the following code to jump to the specified SERVER.
Problem title, use the following code to jump to the specified server
rewrite ^/(.*)$ http://xxxx.cn/index.php?id=/$1 permanent;
Now, want to jump to the server in getting this nginx server IP address, using PHP, commonly used to get the code seems to get not, ask whether there is a way to get to?
$ip = $_server["REMOTE_ADDR"];Echo $ip;?>
Reply content:
Proble
Routing overrides are a very important basic feature of the Web server. By routing rewriting, you can structure URLs and be more semantic (useful for SEO). In addition, the sharing of the URL may be due to the program routing changes in the URL invalidation, and route rewriting can be a good solution to such problems.
The proper use of the rewrite function can bring us a lot of benefits. The functionality of rewr
In the process of URL optimization, it is unavoidable to involve nginx rewrite rules. So how is the Nginx rewrite configured?Rewrite can be found in 4 places: ngx_http_srv_conf,ngx_http_sif_conf,ngx_http_loc_conf,ngx_http_lif_conf. correspond to each other:
Ngx_http_srv_con
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.Nginx common Rewrite Pseudo-static rules:Pseudo
Talking about the difference between rewrite of apache and nginx. For more information, see 1. Nginx Rewrite rule related commands.
Commands related to Nginx Rewrite rules include if, rewrite
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.