nginx配置前后端分离服务

复制代码
 1 user  nginx;
 2 
 3 worker_processes  auto; 
 4 
 5 #error_log  logs/error.log;
 6 
 7 #error_log  logs/error.log  notice;
 8 
 9 error_log  logs/error.log  info;
10 
11  
12 
13 pid        logs/nginx.pid;
14 
15 events {
16 
17     worker_connections  1024;
18 
19 }
20 
21 http {
22 
23     include       mime.types;
24 
25     default_type  application/octet-stream;
26 
27  
28 
29     log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
30 
31                       '$status $body_bytes_sent "$http_referer" '
32 
33                       '"$http_user_agent" "$http_x_forwarded_for"';
34 
35  
36 
37     access_log  logs/access.log  main;
38 
39  
40 
41     sendfile        on;
42 
43     tcp_nopush     on;
44 
45  
46 
47     keepalive_timeout  65;
48 
49     server {
50 
51         listen       80;
52 
53         server_name  localhost;
54 
55         #前端dist路径
56 
57         root   /usr/local/nginx/html/dist-army;
58 
59         index  index.html index.htm; 
60 
61    #后端接口地址
62 
63         location ^~ /v1/ {
64 
65            index index;
66 
67            proxy_pass http://XXXXXXX:9090;
68 
69         }
70 
71    }
72 
73 }
复制代码

 

posted @   lem985  阅读(926)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示