# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
worker_processes auto;
#pid C:\\Java\\nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
#include C:\sys\tools\nginx24\conf\*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
error_log C:\\sys\\tools\\nginx24\\logs\\nginxerror.log debug;
access_log C:\\sys\\tools\\nginx24\\logs\\access.log main;
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include mime.types;
default_type text/html;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
#include C:\\sys\\tools\\nginx24\\conf\\*.conf;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root C:\\Java\\product\\html;
# Load configuration files for the default server block.
#include /etc/nginx/default.d/*.conf;
location ^~/api {
proxy_pass http://127.0.0.1:8022/api;
}
location ^~ /min/ {
rewrite ^/min/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:8226/;
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_set_header X-Forwarded-Proto $scheme;
access_log C:\\sys\\tools\\nginx24\\logs\\min_access.log;
error_log C:\\sys\\tools\\nginx24\\logs\\min_error.log debug;
}
location ~ \.js$ {
add_header Content-Type application/javascript;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}
配置后 使用本地访问 http://127.0.0.1/min 报错 404, 可是 http://127.0.0.1:8226 可以访问