You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
spring-boot-online-exam/doc/deploy/nginx.conf

58 lines
1.4 KiB

5 months ago
events {
# 工作进程的最大连接数
5 months ago
worker_connections 1024;
}
5 months ago
http {
# 包含mime.types文件
5 months ago
include mime.types;
# 默认文件类型
5 months ago
default_type application/octet-stream;
# 开启sendfile功能
5 months ago
sendfile on;
# 保持连接超时时间
5 months ago
keepalive_timeout 65;
# 定义一个server
5 months ago
server {
# 监听80端口
5 months ago
listen 80;
# 服务器名称
5 months ago
server_name localhost;
5 months ago
# 404页面跳转
location / {
# 如果请求的文件不存在则尝试加载index.html
5 months ago
try_files $uri /index.html;
}
5 months ago
# 静态资源目录即vue打包后的dist里的静态资源
root /usr/share/nginx/html/;
# 默认首页
5 months ago
index index.html index.htm;
5 months ago
# 后端服务的配置
location /api/ {
# 关闭代理重定向
proxy_redirect off;
# 设置代理请求头
5 months ago
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# 后端服务地址
proxy_pass http://localhost:9527/api/;
}
# 错误页面
5 months ago
error_page 500 502 503 504 /50x.html;
# 错误页面路径
5 months ago
location = /50x.html {
root html;
}
}
}