user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/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 /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
client_max_body_size 500m;
/*开启压缩*/
gzip on;
gzip_disable “MSIE [1-6].”;
gzip_types text/plain application/x-javascript text/css text/javascript;
include /etc/nginx/conf.d/*.conf;
/* 本地APP server */
upstream tomcat{
server 127.0.0.1:8080;
}
server {
listen 80;
server_name 自己的IP或者域名;
charset UTF-8;
access_log on;
location / {
proxy_pass tomcat;/* 本地APP server */
proxy_http_version 1.1;
include proxy.conf;
}
//配置虚拟映射
location /data/{
alias /data;
}
}
}