你要尽全力保护你的梦想。那些嘲笑你梦想的人,因为他们必定会失败,他们想把你变成和他们一样的人。

nginx配置nginx.config 文件中废话不多说上代码

#user root;
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 {


client_max_body_size 8M; //设置最大的图片值
client_body_buffer_size 128k;
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;

#gzip on;


server {
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server{
listen 8086;
server_name 192.168.0.138;
location / {
root D:/resource/;
index index.html index.htm;
}
}

server {
underscores_in_headers on;
listen 8080;
server_name localhost;
location / {
root html/dist;
try_files $uri $uri/ /index.html last;
index index.html index.htm;
}
location /api/{ #进行路由转发
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8081/; #这里设置为你的jar包跑的端口
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}








}