To automatically list directory configurations:
Download the open source software are aware that a very simple page lists all the versions of the source code, which is to open the automatic listing directory
The following configuration, in the virtual host location/{...} Configure automatic listing of directories in directory control:
Location/{
autoindex on;
}
Browser Local Cache settings:
The browser is to speed up browsing, the browser on the user's disk to the most recently requested file storage, when the visitor again request this page,
Browsers can display files from local disks to speed up browsing, save network resources and improve network efficiency
Keywords: expires
Default value: Off
Scope: Http,server.location
Purpose: To control the header information of "Expires" and "Cache-control" in HTTP responses via Expires instruction
Configuration items:
Location ~. *\. (gif|jpg|jpeg|png|bmp|swf) $
{
expires 30d;
}
Location ~. *\. (JS|CSS)? $
{
expires 1h;
}
To Configure a virtual host:
Nginx can be configured with multiple types of virtual hosts, ip-based, based on a domain based port,
A simple saying is that different IP same port, different port same IP or domain name, different domain name same port
The following is a virtual host configuration file based on the same domain name:
server {Listen default;
server_name www.wpython.com;
Index index.html index.htm index.php;
root/alidata/www/www.wpython.com;
# wordpress Pseudo-Static rule location/{if (-F $request _filename/index.html) {rewrite (. *) $1/index.html break;
} if (f $request _filename/index.php) {rewrite (. *) $1/index.php;
} if (!-f $request _filename) {rewrite (. *)/index.php;
} rewrite/wp-admin$ $scheme://$host $uri/permanent; Location ~. *\.
(PHP|PHP5) $ {fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Include fastcgi.conf; } location ~. *\.
(gif|jpg|jpeg|png|bmp|swf) $ {expires 30d; } location ~. *\.
(JS|CSS)? $ {Expires 1h;
} Access_log/alidata/log/nginx/access/www.wpython.com.log;
server {Listen default;
server_name www.pyyw.net;
Index index.html index.htm index.php; Root/alidata/www/wwW.pyyw.net;
# wordpress Pseudo-Static rule location/{if (-F $request _filename/index.html) {rewrite (. *) $1/index.html break;
} if (f $request _filename/index.php) {rewrite (. *) $1/index.php;
} if (!-f $request _filename) {rewrite (. *)/index.php;
} rewrite/wp-admin$ $scheme://$host $uri/permanent; Location ~. *\.
(PHP|PHP5) $ {fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Include fastcgi.conf; } location ~. *\.
(gif|jpg|jpeg|png|bmp|swf) $ {expires 30d; } location ~. *\.
(JS|CSS)? $ {Expires 1h;
} Access_log/alidata/log/nginx/access/www.pyyw.net.log;
}