Nginx rwrite and add Nginx modules that do not record specific statuses
Requirement: log.bkjia.com/q.gif is successfully accessed, 404 is returned for other paths, and 404 is not logged.
Step 1: Configure nginx rewrite1. Configure nginx rewriteServer {Listen 8000;Server_name
Update nginx, view the installed modules, hide or modify the version number, and view the installed modules.
[root@mail ~]# /opt/nginx/sbin/nginx -Vnginx version: nginx/0.5.34built by gcc 3.4.6 20060404 (Red Hat 3.4.6-3)configure
Installing NginxYum installation Reference http://nginx.org/en/linux_packages.htmlCompile and install NginxThe system first installs the gcc* package and some dependent packages[email protected] tool]# wget http://nginx.org/download/nginx-1.8.0.tar.gz[Email protected] tool]# tar XF nginx-1.8.0.tar.gz-c/usr/local/src/[Email protected] tool]# cd/usr/local/src/nginx
Upgrade to view the modules that have been installed
[Root@mail ~]#/opt/nginx/sbin/nginx-vnginx version:nginx/0.5.34built by gcc 3.4.6 20060404 (Red Hat 3.4.6-3) Configure a Rguments:--prefix=/opt/nginx--sbin-path=/opt/nginx/sbin/nginx
Under the Ubuntu system, we usually use apt-get to get everything done, easy and quick. But if you want to add additional modules to the Nginx, you need to recompile. Compiling nginx from the source code will manually supplement some of the files provided by the Debian package, such as startup scripts, Logrotate, and so on.Get the extra
Review the installed versions and modules before upgrading[[emailprotected]~]#/opt/nginx/sbin/nginx-vnginxversion:nginx/0.5.34built bygcc3.4.620060404 (redhat3.4.6-3) configurearguments:-- prefix=/opt/nginx--sbin-path=/opt/nginx/sbin/ngi
Find the source root directory where the nginx is installed, and if not, download the new source code
http://nginx.org
Tar xvzf nginx-1.3.2.tar.gz
View Ngixn version Extremely compile parameters
/usr/local/nginx/sbin/nginx-v
Access to the Nginx source directory
CD
Nginx integrates mp4 and flv modules
Note:After nginx 1.1.3, mp4 and flv modules are supported by default, and no third-party modules are required.Procedure:1: decompress, compile nginx, compile and add mp4 and flv
1 nginx filter module Introduction
The filter module filters response headers and content. It can process the response headers and content. After obtaining the reply content,Before sending a response to the user. The processing process is divided into two phases: filter the HTTP response header and body. In these two phases, you can.
2. filter module execution sequence
2.1 ngx_http_output _ (Head, body) _ filter_pt
Let's take a look at the common filt
To see which module commands are installed:[[Email protected]-Powercache-X xcache]# Nginx/Sbin/Nginx-VNginx Version:nginx/1.2.3Built by GCC4.4.720120313(Red Hat4.4.7-3) (GCC)TLS SNI Support EnabledConfigure arguments:--Prefix=/Opt/XCache/Nginx--With-IPv6--With-Http_ssl_module--With-Http_stub_status_module--With-Http_flv_module--With-Http_mp4_module--Without-Http_
; Upload_set_form_field "${upload_field_name}_path" $upload _tmp_path; # Upload module automatically generates some information, such as file size and file MD5 value Upload_aggregate_form_field "${upload_field_name}_md5" $upload _file_md5; Upload_aggregate_form_field "${upload_field_name}_size" $upload _file_size; # allowed fields, allow all can "^.*$" Upload_pass_form_field "^submit$|^description$"; # Byte speed control per second, 0 means uncontrolled, default 0 upload_
Nginx feature: Simple use of upstream modules and cachesObjective:
This article goes on to nginx feature: from compile to install to URL rewrite to introduce the use of Nginx load Balancer module, the experiment in this paper does not consider the majority of cases, such as data synchronization between two Web
The previous chapters have compiled the Nginx event module, which begins to tidy up the HTTP module.
The initialization of the HTTP module is done in the ngx_http_block function in src/http/nginx_http.c. configuration of the HTTP module
Before looking at Nginx_http_block, we must also look at the configuration file of the HTTP large module in nginx.conf, only understand the configuration of the HTTP module, in order to better understand how the HTTP m
)!= 2 {
Return ""
}
If pair[0]!= "username" | | PAIR[1]!= "password" {
Return ""
}
return pair[0]
}
Conclusion
I'm still quite fond of Nginx's LUA modules. It allows you to do some simple work on the Web server's request/response cycle, and it makes sense for some operations, such as checking the proxy server for validation. These things have been difficult for a Web server that is not programmable, so it is very likely that we will need to w
The following set of modules allows you to configure how visitors access your website and the "the" the "Your Server logs request" S.IndexThe index module provides a simple directive named Index, which lets your define the page that Nginx would serv E By default if no filename was specified in the client request (on other words, it defines the website index page). specify multiple filenames; the first file
;waiting– The number of long connections currently active : 106. #只是keep-alive, there is no active connection.Nginx official explanation is as follows:Active connections–number of all open connectionsServer accepts handled Requests–nginx accepted 16630948 connections, handled 16630948 connections (no one was closed jus T it was accepted), and handles 31070465 requests (1.8 requests per connection)Reading–nginx
Http_image_filter_module is an integrated image processing module provided by Nginx, Support nginx-0.7.54 later version, when the website traffic is not very high disk limited do not want to generate redundant picture files under the premise can, you can use it to zoom in real time pictures, rotate pictures, verify the validity of pictures and get picture width and image type information, because it is the
nginx Third-party module: https://www.nginx.com/resources/wiki/modules/Unzip Ngx_cache_purge-master.zip unzip Nginx_tcp_proxy_module-master.zip tar zxvf nginx-1.8.0.tar.gz cd nginx-1.8.0# Tip: If there is no patch command for yum install PATCH-YPATCH-P1 #查看已编译的模块:/etc/nginx/
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.