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 }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM