Case 1: Building an Nginx serverCase 2: User authenticationCase 3: Domain-based virtual hostCase 4:SSL Virtual Host1 Case 1: Building Nginx Server1.1 QuestionsInstall the Nginx service on the host with IP address 192.168.4.5 and the Nginx server, which requires the following functions to be enabled at compile time:Supp
=name:val:domain[:lifetime[:p Ath]] ' (set cookies)It sets a cookie on the client browser. The name of the cookie is name and its value is Val. The Domain field is the field for the cookie, such as '. Apache.org ', where the optional lifetime is the number of minutes of the cookie's lifetime, and the path to the cookie is the alternative path.
Actually, there are http://man.chinaunix.net/newsoft/ApacheManual/mod/mod_rewrite.html in the Apache Handbook.
The official
Guide
Nginx is an open source high-performance HTTP server and reverse proxy server, while supporting the IMAP/POP3 Proxy service, is a free software, but also the operation and maintenance engineers will be a kind of server, the following I would simply say the installation of Nginx server and file resolution.
Simple installation
This tutorial is a CentOS 6.3 example, the package can be downlo
First, nginx anti-theft chain
The configuration is as follows and can be combined with the above configuration.
vim /usr/local/nginx/conf/vhost/test.com.conflocation ~* ^.+\.(gif|jpg|png|swf|flv|rar|zip|doc|pdf|gz|bz2|jpeg|bmp|xls)$ //location后面的*是忽略大小写{ expires 7d; valid_referers none blocked server_names *.test.com ; //白名单 if ($invalid_referer) { return 403; } acce
12.13 Nginx anti-theft chainCd/usr/local/nginx/conf/vhostVI test.com.confCopy the above content to a locationTest, successPremise data/wwwroot/test.com directory to have 1.gif12.14 Nginx Access ControlCd/usr/local/nginx/conf/vhostVI test.com.conffffff,t_100,g_se,x_10,y_10,shadow_90,type_zmfuz3pozw5nagvpdgk= "alt="
First, PathInfo support method1.2 Version of the system has automatically generated a pathinfo configuration file, but the actual measurement is not available, so we first find this file and modify its contents, the file path is:/usr/local/nginx/pathinfo.conf, the content is modified as follows:Set $path _info ""; #定义变量 $real _script_name for storing the real address set $real _script_name $fastcgi _script_name; #如果地址与引号内的正则表达式匹配if ($ Fastcgi_script_n
The following content of this article will be updated here: "http-flv Live Module (nginx-http-flv-module) based on Nginx-rtmp-module module" continued. Note: Many of the configurations below are no longer available because the implementation is somewhat different from the earlier implementations. In order to see the history of the entire project, it has been retained, and the following update mentions why s
Linux Nginx 301 Redirect Jump method Summary, there is a need for friends to refer to.
The first case: access to the AAAAAAA station directed to the BBBBBBBBBBB station
Copy Code code as follows:
server {
Server_naaaaaaame www.aaaaaaa.com;
Rewrite ^ (. *) http://www.bbbbbbbbbbb.com$1 permaaaaaaanent;
}
In the second case: not all redirects to the AAAAAAA station are redirecte
Nginx and PHP-FPM built a status page, for want to understand the status of Nginx and monitor nginx is very helpful. For subsequent Zabbix monitoring, we need to know what the Nginx status page is.
1. Enable Nginx status configuration
Add location to the default host or the
Nginx anti-theft chain first into the/usr/local/nginx/conf/vhost/directory, edit the configuration file vim Test.com.confvim test.com.conf then the contents of the following location ~ ^.+. (Gif|jpg|png|swf|flv|rar|zip|doc|pdf|gz|bz2|jpeg|bmp|xls) ${expires 7d; valid_referers None blocked Server_names . test.com; if ($invalid _referer) {return 403;} Access_log off;} Valid_referers none blocked Server_names
Solve the HTTP rewrite module requires the PCRE library.Installation Process
Download the nginxpackage (or wgethttp: // nginx.org/download/nginx-1.9.15.tar.gz) from http://nginx.org/download/nginx-1.9.15.tar.gzdirectly on the linux System)
Decompress the package and go to the directory.
tar -zxvf nginx-1.9.15.tar.g
in/usr/include/pcre/... not foundChecking for PCRE library in/usr/pkg/... not foundChecking for PCRE library in/opt/local/... not found
./configure:error:the HTTP Rewrite module requires the PCRE library.You can either disable the module by Using–without-http_rewrite_moduleoption, or install the PCRE library into the system, or build the PCRE libraryStatically from the source with Nginx by using–with-p
AllowOverride All Order allow,deny Allow from all
AllowOverride can only be defined in the Directory Section. for specific usage, refer to the apache official instructions (below). The above scripts are generally placed in httpd. conf or/etc/httpd/conf. d/vhost. in conf, try to configure the website as much as possible:
....
Together to facilitate maintenance.
III. test the Rewrite function
The following is a. htaccess test instance:
First, nginx anti-theft chainThe configuration is as follows and can be combined with the above configuration.Location ~* ^.+\. (Gif|jpg|png|swf|flv|rar|zip|doc|pdf|gz|bz2|jpeg|bmp|xls) ${Expires 7d;Valid_referers none blocked Server_names *.test.com;if ($invalid _referer){return 403;}Access_log off;}Second, Nginx access controlRequirements: Access to the/admin/directory request, only a few IP access is all
/local/nginx/sbin/nginx #启动Nginx服务 NETSTAT-UTNLP | grep:80 Systemctl Start mariadb #启动数据库服务 Netstat-utnlp | grep:3306 or Systemctl status mariadb systemctl start php-fpm #启动php-fpm Service BR>NETSTAT-UTNLP | grep:9000 or Systemctl status php-fpm 1.2 Static and dynamic separationWhen a user visits a Web site, it matches the found page according to location, an
Nginx pseudo static configuration tutorial summary, nginx pseudo static tutorial
To configure pseudo-static in nginx, that is, the url rewriting function, you only need to write the rewrite rules in the nginx. conf configuration file.
Of course, this rule requires you to b
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.