---- Nginx virtual host configuration
simplify the configuration
HTTP {
Server {
the listen defalut 80;
server_name _ *;
access_log logs / main default.access.log;
LOCATION / {
index index.html;
the root / var / WWW / default / the htdocs;
}
}
}
two or more virtual hosts
HTTP {
Server {
the listen 80;
server_name www.test1.com;
access_log logs / main test1.access.log;
LOCATION / {
index index.html;
the root / var / WWW / test1. COM / the htdocs;
}
Server {
the listen 80;
www.test2.com server_name;
access_log logs / main test2.access.log;
LOCATION / {
index index.html;
the root /var/www/test2.com/htdocs;
}
}
}
establish word file in the folder in the parent folder executed subdomain
Server {
the listen 80; # can also be used xxxx: 80 indicates
.. server_name star.test1.com WWW * * .test1.com test3.com; #_ * :?
# plurality of host names separated by spaces
root / the PATH / the TO / WERROOT / $ Host;
error_page 404
access_log logs / star.test1.com.access.log;
LOCATION / {
the root / the PATH / the TO / WERROOT / $ HSOT /;
index the index.php;
}
.. ~ LOCATION * ^ + (JPG | JPEG | GIF | CSS | PNG | JS | ICO | HTML) {$
access_log OFF;
Expires 30d;
}
LOCATION ~ {/.ht
the deny All;
}
}
instruction:
Expires [Time | epoch | max | pff]: http can modify the response of the "Expires" and "cache-control" header (page cache control play the role)
default value: off
parameter:
Time: use positive or negative. "Expires" header is added to the setting value of the time value determined by the current time;
may control the "Cache-control": time = negative: Cache represents-NO
time = 0 or a positive number: indicates time = Age-max
Epoch: Specify "Expires" is January 1, 1970,00: 00: 01 GMT;
max: Specifies the "Expires" to 31 December2037 23: 59: 59GMT, "
-1: Specifies the "Expires" for the current server time -1s, that is never expired;
OFF: does not modify the value of the "Expires" and "Cache-Control" is.
nginx ---- virtual host configuration
Guess you like
Origin www.cnblogs.com/zyxy5207/p/11879097.html
Ranking