Configuring Front and Back End Interfaces with Nginx on Linux
Technical otaku
2022-12-16
1. Edit the nginx.conf configuration file command
## /usr/local/nginx/ nginx installation path
vim /usr/local/nginx/conf/nginx.conf
2. Backend interface configuration information
server {
listen 80; # configure port
server_name localhost; # configure domain name
charset utf-8; # encoding
access_log /usr/local/nginx/logs/access.log main; # success log
error_log /usr/local/nginx/logs/error.log error; # error log
index index.html; # Find file order
# other locations
#Static resource access
location / {
#------------------Foreground resource and path ------------------
root /songwp/project/sjsk/dist;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /api {
proxy_pass http://127.0.0.1:56668;
}
#/api/esbapi Matching and address interception of front-end requests
#http://localhost:4800/api/esbapi/manager/cm0004 Retain /manager/cm0004 after interception
#Then locate the backend address /esbapi/manager/cm0004 where esbapi is the context-path of the backend
location /api/esbapi {
proxy_pass http://127.0.0.1:56668/esbapi;
}
location /api/mqcore {
proxy_pass http://127.0.0.1:56666/mqcore;
}
location /api/mqtask {
proxy_pass http://127.0.0.1:56669/mqtask;
}
}
}
3. Reload the configuration file
## Enter the executable file directory
cd /usr/local/nginx/sbin
## Reload configuration file
./nginx -s reload
buy lipitor 40mg sale & lt;a href="https://lipiws.top/"& gt;purchase atorvastatin pills& lt;/a& gt; atorvastatin pill
Cevaaq
2024-03-08