Nginx 访问静态html 文件方式
Nginx 访问静态html 文件方式
nginx 配置:
user nginx nginx;
worker_processes 8;
worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;
worker_rlimit_nofile 65536;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 65536;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr [$time_local] $upstream_addr $upstream_status $upstream_response_time "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"';
log_format cachelog '$time_local - $upstream_cache_status - Cache-Control:$upstream_http_cache_control - $request($status) - ';
access_log logs/access.log main;
sendfile on;
tcp_nopush on;
proxy_ignore_client_abort on;
keepalive_timeout 65;
#keepalive_timeout 1000;
charset utf-8;
gzip on;
gzip_min_length 10k;
gzip_buffers 4 16k;
gzip_comp_level 2;
gzip_types text/plain text/javascript application/javascript application/x-javascript text/css application/xml application/octet-stream;
gzip_vary on;
server {
#被监听的端口号和网址
listen 80;
server_name www.test.com;
#charset koi8-r;
access_log logs/test_access.log main;
location / {
#这个地方指定被访问的文件夹位置
root /data/test;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|css|js)$ {
root /data/test;
expires 30d;
}
}
#location ~ /purge(/.*){
# allow 192.168.0.0/16;
# deny all;
# proxy_cache_purge resource $host$1$is_args$args;
#}
}
更多Nginx相关教程见以下内容:
Nginx 的详细介绍:请点这里
Nginx 的下载地址:请点这里
相关推荐
运算符用于执行程序代码运算,会针对一个以上操作数项目来进行运算。以上实例中 7、5 和 12 是操作数。关系运算符用于计算结果是否为 true 或者 false。逻辑运算符用于测定变量或值之间的逻辑。