1. Scene
Nginx implements the separation of front and back end, and the reverse proxy of service cluster.
2. Nginx configuration instance
upstream portal-system {
server 127.0.0.1:8061 max_fails=3 fail_timeout=30s;
server 172.31.88.30:8061 max_fails=3 fail_timeout=30s;
}
server {
listen 80;
server_name 47.102.168.177;
root /opt/pages/dispatch-portal-system/;
location/{
proxy_set_header Host $host:$server_port;
proxy_pass http://portal-system;
}
location /images/ {
alias /opt/images/dispatch-portal-system/;
}
location /favicon.ico {
root /opt/images/dispatch-portal-system/;
}
location /api/user/updateImage/ {
proxy_set_header Host $host:$server_port;
proxy_pass http://127.0.0.1:8061/;
}
location =/{
root /opt/pages/dispatch-portal-system/;
add_header Cache-Control "no-cache, no-store";
}
location /index.html {
root /opt/pages/dispatch-portal-system/;
add_header Cache-Control "no-cache, no-store";
}
location /static/ {
root /opt/pages/dispatch-portal-system/;
}
}
Read More:
- NxL job cluster nginx routing forwarding and reverse proxy
- The back end cannot receive the parameters passed by the front end
- Nginx reverse proxy MySQL
- Nginx modifies the front end request size limit (413 request entity too large)
- Nginx reverse proxy report 400 error solution!
- Front end project construction error unexpected character ‘@’ solution
- Decipher the evolutionary path of junior, middle and senior programmers (front end)
- Hide print button when printing page in front end
- The solution of flashing back after the end of console program running
- Front end Vue project operation error module build failed
- Record a front end error net:: err_ HTTP2_ PROTOCOL_ ERROR 200
- What are the web front end technologies? What are the differences between cookie and session
- Jsonformat annotation solves the problem of time format in the front end of localdatetime
- Front end project runtime prompts syntax error: typeerror: token.type.endswith is not a function solution
- The time of the time database displayed by the front end is inconsistent
- Record the pits you stepped on – NSS error – 5938 (PR_ END_ OF_ FILE_ ERROR), curl: (35) Encountered end of file
- When configuring the proxy with Vue, the front-end requests the server-side error 504; the Vue console reports the error occurred while trying to proxy request
- Nginx start error: job for nginx.service failed because the control process exited with error code
- Boot nginx flash back under Windows
- nginx: [emerg] unknown directive “proxy_pass“