我是 saleor.io 的新手,这是一个电子商务应用程序和 nginx 的开源平台。该销售商具有三个模块:
- Saleor 核心(Django 项目,通过 graphql api 与 saleor store 和 saleor dashboard 通信,连接到 postgresql,运行在 192.168.0.102/grapghql/)
- Saleor 仪表板(Node 项目,包含 javascript,键入脚本文件,在 192.168.0.102:70 上运行)
- Saleor Store(Node项目,包含javascript,类型脚本文件)
我在 nginx 上运行这三个模块,并且 UI 完美地显示了每个模块。但是当我尝试通过仪表板登录时,我得到了这个 CORS 错误:
这是我的 saleor 核心的 nginx 配置文件:
upstream django {
server unix:///home/umair/PythonDjangoProjects/GitSaleor/mysite.sock fail_timeout=9000; # for a file socket
# server 192.168.0.102:80; # for a web port socket (we'll use this first)
}
# configuration of the server
server {
# the port your site will be served on
listen 80;
# the domain name it will serve for
server_name 192.168.0.102; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 75M; # adjust to taste
# Django media
location /media {
alias /home/umair/PythonDjangoProjects/GitSaleor/media; # your Django project's media files - amend as required
}
location /static {
alias /home/umair/PythonDjangoProjects/GitSaleor/static; # your Django project's static files - amend as required
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include /home/umair/PythonDjangoProjects/GitSaleor/uwsgi_params; # the uwsgi_params file you installed
} }
这是我的销售或仪表板的 nginx 配置文件:
server {
listen 70;
listen [::]:70;
root /var/www/html/dashboard;
index index.html;
server_name 192.168.0.102;
location / {
try_files $uri $uri/ /index.html?$args;
}
}
我该如何解决这个错误?我是否缺少配置中的任何内容。