1. Business scenarios
According to the business requirements, the front-end code needs to distinguish between the main business code and the sub business code.
2. Solutions
Routing is based on the root of the relative path.
3. Configuration file
server {
listen 9207;
server_name 192.168.30.158;
root /home/qdfinance/apps/pages/insure_wx/;
#Front-end dependent business code pages are routed with relative paths to root/h5
location /h5/ {
root /home/qdfinance/apps/pages/insure_wx_h5/;
add_header Cache-Control "no-cache, no-store";
rewrite ^/h5/(.*)$ /index.html break;
}
#Reverse proxy tomcat service
location/{
proxy_set_header Host $host:$server_port;
proxy_pass http://192.168.80.192:8098/;
root /home/qdfinance/apps/pages/insure_wx/;
error_page 404 /index.html;
}
#Front-end main business code page
location =/{
root /home/qdfinance/apps/pages/insure_wx/;
add_header Cache-Control "no-cache, no-store";
}
location /index.html {
root /home/qdfinance/apps/pages/insure_wx/;
add_header Cache-Control "no-cache, no-store";
}
location /statich5/ {
root /home/qdfinance/apps/pages/insure_wx_h5/;
}
location /static/ {
root /home/qdfinance/apps/pages/insure_wx/;
}
location /detail/ {
rewrite ^/(.*)$ /index.html last;
}
location /me {
rewrite ^/(.*)$ /index.html last;
}
location /login/ {
rewrite ^/(.*)$ /index.html last;
}
location /customer {
rewrite ^/(.*)$ /index.html last;
}
location /customer-add {
rewrite ^/(.*)$ /index.html last;
}
location /subscribe {
rewrite ^/(.*)$ /index.html last;
}
location /order {
rewrite ^/(.*)$ /index.html last;
}
location /order-detail {
rewrite ^/(.*)$ /index.html last;
}
location /main {
rewrite ^/(.*)$ /index.html last;
}
location /auth {
rewrite ^/(.*)$ /index.html last;
}
location /policy {
rewrite ^/(.*)$ /index.html last;
}
location /intellect {
rewrite ^/(.*)$ /index.html last;
}
location /intellectanswerlist {
rewrite ^/(.*)$ /index.html last;
}
location /immed {
rewrite ^/(.*)$ /index.html last;
}
location /docking {
rewrite ^/(.*)$ /index.html last;
}
location /success {
rewrite ^/(.*)$ /index.html last;
}
location /error {
rewrite ^/(.*)$ /index.html last;
}
}
Read More:
- Running the test front-end project, Google browser accesses localhost with err_SSL_PROTOCOL_ERROR
- Syntaxerror: unexpected end of JSON input [How to Solve]
- [Solved] SyntaxError: Unexpected end of JSON input
- Windows: Nginx configuration error GetFileAttributesEx
- [Solved] Git Push Error: &fatal: the remote end hung up unexpectedly
- frida.InvalidArgumentError: script(line *): SyntaxError: unexpected end of string
- [Solved] hello.s:15 Error: junk at end of line, first unrecognized character valued 0x8
- Nginx Container Error: nginx: [emerg] mkdir() “/var/cache/nginx/client_temp“ failed (13: Permission denied)
- [Solved] Parsing JSON error unexpected end of JSON input
- error: expected ‘;‘ at end of member declaration and expected ‘)‘ before ‘&‘ toke Errors
- [Solved] PostgreSQL Error: ERROR: CURRENT TRANSACTION IS ABORTED, COMMANDS IGNORED UNTIL END OF TRANSA
- Compile .h file with error “error: backslash-newline at end of file [-Werror]:
- Nginx: How to Use Error_Page
- keil error #1-D: last line of file ends without a newline
- [Nginx] Configure nginx to support websocket to solve the problem of returning 400 error
- [Solved] Playbook Start Nginx Error: Unable to start service nginx: Job for nginx.service fd with error code
- [Solved] Docker Start nginx error: driver failed programming external connectivity on endpoint nginx
- No match for ‘operator =’ both ends of the equal sign do not match
- [Solved] flutter Project Error: ScrollController attached to multiple scroll views, Failed assertion: line 109 pos 12
- [Solved] jumpserver nginx Error: Connect websocket server error