1.x版本部署线上后显示账号密码不正确, 测试环境却没有问题

发布于 2022-05-03 14:34:11

图片访问的是nginx 80端口
微信图片_20220503142459.png
nginx 配置

events {

worker_connections  1024;

}
http {

include       mime.types;
default_type  application/octet-stream;
sendfile        on;

#server {
    #listen 80 default_server;
    #server_name _;
    #return 404;
    #}

# 后端 server
server {
    listen       8000;
    server_name  10.0.8.13;
    charset utf-8;
    location / {
      root html/www;
      include uwsgi_params;
      uwsgi_pass 127.0.0.1:9000;
      uwsgi_param UWSGI_SCRIPT home.wsgi;
      uwsgi_param UWSGI_CHDIR /data/site/op/backend/; #项目路径
    }
    # Django media
    location /media  {
        root /data/site/op/backend/media;  # your Django project's media files - amend as required
    }
    # Django static
    location /static {
        root /data/site/op/backend/static; # your Django project's static files - amend as required
    }
    access_log /data/logs/backend.access.log;
    error_log  /data/logs/backend.error.log;
}
# 前端配置
server {
    listen       80;
    server_name  10.0.8.13;
    charset utf-8;
    location / {
      try_files $uri $uri/ @router; #需要指向下面的@router否则会出现vue的路由在nginx中刷新出现404
      root   /data/site/op/ui/dist/;
      add_header  Cache-Control  max-age=no-cache;
      index  index.html index.php index.htm;
    }
    location ~* \.(css|js|png|jpg|jpeg|gif|gz|svg|mp4|ogg|ogv|webm|htc|xml|woff)$ {
        access_log off;
        add_header Cache-Control max-age=604800;
        root   /data/site/op/ui/dist/;
        index  index.html index.php index.htm;
    }
    location @router {
        rewrite ^.*$ /index.html last;
    }
    access_log /data/logs/ui.access.log;
    error_log  /data/logs/ui.error.log;
}

}

uwsgi.ini
[uwsgi]
chdir = /data/site/op/backend
wsgi-file = /data/site/op/backend/application/wsgi.py
master = true
processes = 8
http-socket = 127.0.0.1:9000
module = application.wsgi:application
vacuum = true
log-maxsize = 20000000
log-reopen = true
buffer-size = 65536

.env.development

开发环境配置

ENV = 'development'

若依管理系统/开发环境

VUE_APP_BASE_API = 'https://api.django-vue-admin.com'

VUE_APP_BASE_API = 'http://127.0.0.1:9000'

路由懒加载

VUE_CLI_BABEL_TRANSPILE_MODULES = true

前端端口

PORT=8080

查看更多

关注者
0
被浏览
926
1 个回答
hongzai
hongzai 认证专家 2022-05-04
life is coding,外包,远程协助,咨询添加微信:H0nGzA1

你init数据了?

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览