莫大人

nginx配置文服

修改nginx.conf

添加如下内容

autoindex on; # 显示目录
autoindex_exact_size on; # 显示文件大小
autoindex_localtime on; # 显示文件时间

 

 

#  power by www.phpStudy.net 
#user  nobody;
worker_processes  1;

error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    #tcp_nodelay on;
  fastcgi_connect_timeout 300;
  fastcgi_send_timeout 300;
  fastcgi_read_timeout 300;
  fastcgi_buffer_size 128k;
  fastcgi_buffers 4 128k;
  fastcgi_busy_buffers_size 256k;
  fastcgi_temp_file_write_size 256k;

  #gzip  on;
  gzip on;
  gzip_min_length  1k;
  gzip_buffers     4 32k;
  gzip_http_version 1.1;
  gzip_comp_level 2;
  gzip_types       text/plain application/x-javascript text/css application/xml;
  gzip_vary on;
  gzip_disable "MSIE [1-6].";

  server_names_hash_bucket_size 128;
  client_max_body_size     100m; 
  client_header_buffer_size 256k;
  large_client_header_buffers 4 256k;
  underscores_in_headers on;
  
  autoindex on; # 显示目录
  autoindex_exact_size on; # 显示文件大小
  autoindex_localtime on; # 显示文件时间
  
  root "F:/work/workspace/smart/spring-smart-html/";
  index  index.html index.htm;		
  
 server {
        listen       80;
        server_name  192.168.64.1 192.168.0.104 127.0.0.1;
        #charset koi8-r;
        #access_log  logs/host.access.log  main;   
		
 	location /smart/ {
        proxy_pass http://localhost:8081/spring-smart-web/smart/;
        proxy_set_header   Host    $host;
        proxy_set_header   X-Real-IP   $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_connect_timeout 300;
		proxy_send_timeout 300;
		proxy_read_timeout 300;
    }		
	
	location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css|less|map|eot|svg|ttf|woff|woff2|cab|scss|otf|exe|pdf|doc|xlsx)$ {	
		root "F:/work/workspace/smart/spring-smart-html/";
		index  index.html index.htm;
		expires 1d;
    }	
}
	include vhost/*.conf;
}

  

访问

 

posted on 2018-08-17 11:45  莫大人  阅读(159)  评论(0编辑  收藏  举报

导航