GreaterWMS / GreaterWMS

This Inventory management system is the currently Ford Asia Pacific after-sales logistics warehousing supply chain process . After I leave Ford , I start this project . You can share your vacant warehouse space, use it for those in need, and generate income
https://www.56yhz.com/
Apache License 2.0
3.71k stars 949 forks source link

[BUG] 注册管理员帐号失败 #269

Closed UnicornUnderMoon closed 1 year ago

UnicornUnderMoon commented 1 year ago

服务器为ubuntu 22.04,局域网地址192.168.1.20。在外通过vpn代理部署GreaterWMS,该机是主机,地址为192.168.20.1。 因官方教程细节上有出入,参照此文用docker部署。前端端口设8010,后端为8011。以下三个文件仅改动ip地址和端口。如下:

GreaterWMS/templates/public/statics/baseurl.txt文件内内容: http://192.168.1.20:8011

GreaterWMS/docker-compose.yml文件内内容:

version: '3.9'
networks:
  basic:
services:
  front:
#    build:
#      context: ./
#      dockerfile: ./docker/front/Dockerfile
    container_name: greaterwms_front
    image: greaterwms/greaterwms_front:latest
    restart: always
    ports:
      - '8010:8080'
    volumes:
      - ./templates:/GreaterWMS/templates:rw
      - ./web_start.sh:/GreaterWMS/templates/webstart.sh
    command:
      - /bin/bash
      - -c
      #- "yarn install --force"
      - |
        bash /GreaterWMS/templates/webstart.sh
    networks:
      - basic
  backend:
#    build:
#      context: ./
#      dockerfile: ./docker/backend/Dockerfile 
    container_name: greaterwms_backend
    image: greaterwms/greaterwms_backend:latest
    restart: always
    volumes:
      - ./:/GreaterWMS/:rw #将前目录挂载到容器下
      - ./supervisord.conf:/etc/supervisor/supervisord.conf
    ports:
      - '8011:8000'
    environment:
      PYTHONUNBUFFERED: 1
    command:
      - /bin/bash
      - -c
      - |
        bash backend_start.sh && /etc/init.d/supervisor start
    networks:
      - basic
#  greaterwms-mysql:
#    image: mysql:5.7
#    container_name: greaterwms-mysql
#    #使用该参数,container内的root拥有真正的root权限,否则,container内的root只是外部的一个普通用户权限
#    #设置为true,不然数据卷可能挂载不了,启动不起
#    privileged: true
#    restart: always
#    ports:
#      - "3306:3306"
#    environment:
#      MYSQL_ROOT_PASSWORD: "GreaterWMS20210816"
#      MYSQL_DATABASE: "greaterwms"
#      TZ: Asia/Shanghai
#    command:
#      --wait_timeout=31536000
#      --interactive_timeout=31536000
#      --max_connections=1000
#    volumes:
#      #映射mysql的数据目录到宿主机,保存数据
#      - "./docker/mysql/data:/var/lib/mysql"
#      #根据宿主机下的配置文件创建容器
#      - "./docker/mysql/conf.d:/etc/mysql/conf.d"
#      - "./docker/mysql/logs:/logs"
#    networks:
#      - basic
#   nginx:
#     image: nginx:1.19.1
#     container_name: greaterwms_nginx
#     restart: always
#     privileged: true
#     environment:
#       - TZ=Asia/Shanghai
#     ports:
#       - 80:80
#       #- 443:443
#     volumes:
#       - /etc/localtime:/etc/localtime:ro
#       - ./nginx.conf:/etc/nginx/nginx.conf:ro
#       - ./static_new/:/GreaterWMS/static_new:ro
#     networks:
#       - basic

GreaterWMS/nginx.conf文件内内容:

user root;
worker_processes auto;

events {
    worker_connections  1024;
}

http {
    include         mime.types;
    default_type    application/octet-stream;
    sendfile        on;
    gzip            on;
    gzip_min_length 1k;
    gzip_comp_level 4;
    gzip_types      text/plain application/javascript application/x-javascript text/javascript text/xml text/css;
    gzip_disable    "MSIE [1-6]\.";
    gzip_vary       on;
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header  https $https;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    client_max_body_size 75M;
    client_body_buffer_size 256k;
    client_header_timeout 3m;
    client_body_timeout 3m;
    send_timeout 3m;
    proxy_connect_timeout 300s;
    proxy_read_timeout 300s;
    proxy_send_timeout 300s;
    proxy_buffer_size 64k;
    proxy_buffers 4 32k;
    proxy_busy_buffers_size 64k;
    proxy_temp_file_write_size 64k;
    proxy_ignore_client_abort on;

    upstream GreaterWMS{
  server 192.168.1.20:8010;
}
    server {
    listen      80;
    server_name {{ Domin Name }};
    rewrite ^(.*)$ https://{{ Domin Name }}$1;

    }

      server {
    listen      443 ssl;

    server_name  {{ Domin Name }};
    root /path/to/GreaterWMS;
    charset utf-8;
    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    client_max_body_size 75M;

    ssl_certificate   /path/to/GreaterWMS.pem;
    ssl_certificate_key  /path/to/GreaterWMS.key;
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;

    access_log off;
    error_log  /path/to/GreaterWMS/greaterwms-error.log error;

     location /websocket/ {
       proxy_pass http://GreaterWMS/;
             proxy_read_timeout 60s;
       proxy_set_header Host $host;
       proxy_set_header X-Real_IP $remote_addr;
       proxy_set_header X-Forwarded-for $remote_addr;
       proxy_http_version 1.1;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection 'Upgrade';
    }

    location / {
        #root   html;
        #index  testssl.html index.html index.htm;
       proxy_redirect off;
       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://127.0.0.1:8008/;
    }
        location /static/ {
            alias /path/to/GreaterWMS/static_new/;
        }
    location /media/{
        alias /path/to/GreaterWMS/media/;
    }
    }
}

当通过vpn访问主机192.168.20.1:8010,注册管理员时反馈,404错误。

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /</pre>
</body>
</html>

另通过apache2,用https反代到8011端口,外网访问https://myinternt:8103/,8103是路由对外端口。可访问网站,但通过该网址注册管理员,反馈“该功能被禁用(405)”。 请问是哪里设置有问题?是不是只能在192.168.1.*网络下才能注册管理员?

Singosgu commented 1 year ago

http://192.168.1.20:8011/

你少个/

UnicornUnderMoon commented 1 year ago

将baseurl.txt文件内内容改为:http://192.168.1.20:8011/ 删除GreaterWMS/templates/dist/spa目录下所有内容,重新进入前端容器,并编译前端代码。
再卸载docker-compose down,重新启动docker-compose up -d 仍未能注册,前端和后端注册管理员时没有反应,同时注意到前端的vConsole信息里,network里register请求项下

General 里内容
http://192.168.1.20:8011/
/register/

Response 响应为空。