nginx配置
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
#upstream tomcats {
#server 127.0.0.1:8086;
# server 127.0.0.1:8088;
#server 127.0.0.1:8089 weight=2;
#}
//自研项目的部署
server {
listen 442 ssl; # 监听443端口并使用SSL
# listen 8082;
server_name localhost;
ssl_certificate "D:/programe xiazai/nginx-1.20.2/conf/server.crt";
ssl_certificate_key "D:/programe xiazai/nginx-1.20.2/conf/server.key";
location / {
# proxy_pass [::] http://127.0.0.1:8088/;
root html1;
#root html;
index index.html ;
}
location /apivitedemo/ {
# 使用 rewrite 指令去除 /api/ 前缀
rewrite ^/apivitedemo/(.*)$ /$1 break;
#proxy_pass http://172.30.210.86:8088/;
proxy_pass http://127.0.0.1:8088;
}
}
//低代码的部署
server {
listen 443 ssl; # 监听443端口并使用SSL
# listen 8082;
server_name localhost;
ssl_certificate "D:/programe xiazai/nginx-1.20.2/conf/server.crt";
ssl_certificate_key "D:/programe xiazai/nginx-1.20.2/conf/server.key";
location /vite/ {
alias "D:/programe xiazai/nginx-1.20.2/html/";
index index.html ;
}
location /api/ {
proxy_set_header X-Skip-Auth true;
# 使用 rewrite 指令去除 /api/ 前缀
rewrite ^/api/(.*)$ /$1 break;
#proxy_pass http://172.30.210.86:8088/;
proxy_pass http://127.0.0.1:8088;
}
}
}