website/nginx.conf

64 lines
2.0 KiB
Nginx Configuration File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 设置运行 Nginx 的用户
user nginx;
# 启动的 worker 进程数量,一般设置为 autoNginx 会自动根据 CPU 数量设置合适的数量
worker_processes auto;
# 错误日志路径和级别
error_log /var/log/nginx/error.log warn;
# PID 文件路径
pid /var/run/nginx.pid;
# 定义全局事件
events {
# 最大连接数
worker_connections 1024;
}
# 定义 HTTP 服务器
http {
# 包含 MIME 类型的文件
include /etc/nginx/mime.types;
# 默认 MIME 类型
default_type application/octet-stream;
# 自定义的 Nginx 配置
server {
# 监听的端口
listen 80;
# 服务器名称
server_name localhost;
location / {
# 网站根目录,此处使用容器内的路径
root /usr/share/nginx/html;
# 默认首页
index index.html;
# 尝试从磁盘找到请求的文件,如果不存在则跳转到 index.html
try_files $uri $uri/ /index.html;
}
# location ^~ /api/ {
# 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_set_header X-NginX-Proxy true;
# #下面两个必须设置请求头设置为ws请求方式
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "upgrade";
# proxy_pass http://192.168.41.101:28003/;
# }
# location /api/login/ {
# # rewrite ^/wsUrl/(.*)$ /$1 break; #拦截标识去除
# proxy_pass http://192.168.41.101:28003/; #这里是http不是ws不用怀疑代理的ip和port写ws访问的实际地址
# proxy_http_version 1.1; #这里必须使用http 1.1
# #下面两个必须设置请求头设置为ws请求方式
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "upgrade";
# }
}
}