更新部署
This commit is contained in:
parent
893c0d0334
commit
758270e2fb
|
|
@ -61,7 +61,7 @@ services:
|
||||||
PORT: 80
|
PORT: 80
|
||||||
NGINX_SERVER_NAME: localhost
|
NGINX_SERVER_NAME: localhost
|
||||||
volumes:
|
volumes:
|
||||||
- "./nginx.conf:/etc/nginx/conf.d/default.conf"
|
- "./selenium_vue/nginx.conf:/etc/nginx/conf.d/default.conf"
|
||||||
depends_on:
|
depends_on:
|
||||||
- selenium-crawl-service
|
- selenium-crawl-service
|
||||||
- selenium-django-service
|
- selenium-django-service
|
||||||
|
|
|
||||||
98
nginx.conf
98
nginx.conf
|
|
@ -1,98 +0,0 @@
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name _;
|
|
||||||
client_max_body_size 5000m;
|
|
||||||
# 启用gzip压缩
|
|
||||||
gzip on;
|
|
||||||
gzip_min_length 2k;
|
|
||||||
gzip_buffers 4 16k;
|
|
||||||
gzip_http_version 1.1;
|
|
||||||
gzip_comp_level 2;
|
|
||||||
gzip_types
|
|
||||||
# text/html is always compressed by HttpGzipModule
|
|
||||||
text/css
|
|
||||||
text/javascript
|
|
||||||
text/xml
|
|
||||||
text/plain
|
|
||||||
text/x-component
|
|
||||||
application/javascript
|
|
||||||
application/x-javascript
|
|
||||||
application/json
|
|
||||||
application/xml
|
|
||||||
application/rss+xml
|
|
||||||
font/truetype
|
|
||||||
font/opentype
|
|
||||||
application/vnd.ms-fontobject
|
|
||||||
application/x-httpd-php
|
|
||||||
image/jpeg
|
|
||||||
image/gif
|
|
||||||
image/png
|
|
||||||
image/svg+xml;
|
|
||||||
gzip_vary on;
|
|
||||||
|
|
||||||
# 前端静态页面
|
|
||||||
root /usr/share/nginx/html;
|
|
||||||
index index.html;
|
|
||||||
|
|
||||||
# 处理 Vue Router 的 history 模式
|
|
||||||
location / {
|
|
||||||
try_files $uri $uri/ /index.html;
|
|
||||||
}
|
|
||||||
|
|
||||||
# 前端路径修改
|
|
||||||
location /selenium_web/ {
|
|
||||||
proxy_pass http://selenium-vue-container:80/;
|
|
||||||
|
|
||||||
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-Forwarded-Proto $scheme;
|
|
||||||
}
|
|
||||||
|
|
||||||
# 后端 API 代理
|
|
||||||
location /selenium_api/ {
|
|
||||||
proxy_pass http://selenium-django-container:8000/;
|
|
||||||
|
|
||||||
# 基本身份头
|
|
||||||
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-Forwarded-Proto $scheme;
|
|
||||||
|
|
||||||
# SSE 关键配置
|
|
||||||
proxy_cache off; # 禁用缓存
|
|
||||||
proxy_buffering off; # 禁用缓冲(关键!)
|
|
||||||
proxy_http_version 1.1; # 使用 HTTP/1.1
|
|
||||||
proxy_set_header Connection ''; # 清除 Connection 头
|
|
||||||
|
|
||||||
# 超时设置(根据需要调整)
|
|
||||||
proxy_read_timeout 3600s; # 读取超时(1小时,根据实际需求调整)
|
|
||||||
proxy_send_timeout 3600s; # 发送超时
|
|
||||||
|
|
||||||
# 可选:设置正确的 Content-Type(如果后端未正确设置)
|
|
||||||
# proxy_hide_header Content-Type;
|
|
||||||
add_header Content-Type "text/event-stream";
|
|
||||||
|
|
||||||
# 可选:允许跨域(如果前端和后端域名不同)
|
|
||||||
add_header Access-Control-Allow-Origin *;
|
|
||||||
add_header Access-Control-Allow-Credentials true;
|
|
||||||
}
|
|
||||||
# 后端爬虫 API 代理
|
|
||||||
location /selenium_crawl_api/ {
|
|
||||||
proxy_pass http://selenium-crawl-container:5000/;
|
|
||||||
|
|
||||||
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-Forwarded-Proto $scheme;
|
|
||||||
}
|
|
||||||
|
|
||||||
# 静态文件
|
|
||||||
location /static1/ {
|
|
||||||
alias /app/static/;
|
|
||||||
}
|
|
||||||
# 媒体文件
|
|
||||||
location /media1/ {
|
|
||||||
alias /app/media/;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -42,7 +42,7 @@ SECRET_KEY = "django-insecure-vz&(x74)s4b9^3_!f^@&f@@0-pq70=m5sztwa#*d9r+z&ac*li
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
|
|
||||||
ALLOWED_HOSTS = ['47.83.141.164', 'localhost', '127.0.0.1', '*']
|
ALLOWED_HOSTS = ["*"]
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue