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