Goal:
1, 80 Port Deployment 2 single page application
2. Single page application adopts H5 history route.
3, the Address bar starts with ' http://ip/1/', then goes to the first single page application, starts with ' http://ip/2/' to go to the second one page application.
Need to be modified:
1, front-end code: The first single-page application should be 1 as the base route, the second single-page application should be 2 as the base route. Example: The first app goes to/home, the Address bar is/1/home.
2, packaging files Publicpath to ' 1 ', so that the reference path is added/1/. Cases:
<script src=/1/js/chunk-vendors.2a8e7123.js> </script> <script src=/1/js/app.dd1c6375.js> </ Script> </body>
3, Nginx configuration is as follows:
server { Listen 8000; server_name localhost; Root D:/nginx/nginx-1.13. /html; ^~/1/{ try_files $uri index1.html /index1.html; } ^~/2/{ try_files $uri index2.html /index2.html; } ^~/api/{ proxy_pass http://10.15.4.113:9000/; }}
HTML folder inside Structure:
│ index1.html│ index2.html│ tree.txt│ ├─1│ ├─xxx│ └─2
Nginx single Port layout multiple single page applications