fix: nginx config
All checks were successful
/ build ushare (push) Successful in 37s
/ clean (push) Successful in 0s

This commit is contained in:
loveuer 2025-06-24 22:24:22 +08:00
parent f8372b8de8
commit ca434c918b
2 changed files with 46 additions and 20 deletions

View File

@ -25,8 +25,7 @@ COPY --from=frontend-builder /app/frontend/dist /usr/share/nginx/html
COPY --from=backend-builder /app/ushare /usr/local/bin/ushare COPY --from=backend-builder /app/ushare /usr/local/bin/ushare
# 配置 Nginx # 配置 Nginx
RUN rm /etc/nginx/conf.d/default.conf COPY deployment/nginx.conf /etc/nginx/nginx.conf
COPY deployment/nginx.conf /etc/nginx/conf.d
COPY deployment/entrypoint.sh /usr/local/bin/entrypoint.sh COPY deployment/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh RUN chmod +x /usr/local/bin/entrypoint.sh

View File

@ -1,23 +1,50 @@
server { user root;
listen 80; worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
location / { events {
root /usr/share/nginx/html; worker_connections 1024;
try_files $uri $uri/ /index.html; }
}
location /api { http {
proxy_pass http://localhost:9119; include /etc/nginx/mime.types;
proxy_set_header Host $host; default_type application/octet-stream;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /ushare { log_format main '$remote_addr - $remote_user [$time_local] "$request" '
proxy_pass http://localhost:9119; '$status $body_bytes_sent "$http_referer" '
const rtc = new RTCPeerConnection({iceServers: [{urls: "stun:stun.qq.com:3478"}]}) '"$http_user_agent" "$http_x_forwarded_for"';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; access_log /var/log/nginx/access.log main;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
}
location /api {
proxy_pass http://localhost:9119;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /ushare {
proxy_pass http://localhost:9119;
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_max_temp_file_size 0;
proxy_request_buffering off;
proxy_buffering off;
client_max_body_size 5M;
}
} }
} }