Развернуть Flutter Web и laravel в качестве внутреннего API для Ubuntu NginxPhp

Кемеровские программисты php общаются здесь
Anonymous
Развернуть Flutter Web и laravel в качестве внутреннего API для Ubuntu Nginx

Сообщение Anonymous »

Flatter интерфейса отлично работает в домене. когда я открываю консоль в браузере, я обнаружил эту ошибку.
[Error] Origin https://www.championmaung.com is not allowed by Access-Control-Allow-Origin. Status code: 404
[Error] XMLHttpRequest cannot load https://championmaung.com/api/login due to access control checks.
Failed to load resource: Origin https://www.championmaung.com is not allowed by Access-Control-Allow-Origin. Status code: 404

Я не уверен, что информация о конфигурации и laravel работает правильно.
файл конфигурации здесь
root@ srv543846:/etc/nginx/sites-available# nano flutter
server {
listen 80;
listen [::]:80;

server_name championmaung.com www.championmaung.com;

root /var/www/html/web;
index index.html;

location / {
try_files $uri $uri/ /index.html;
}

error_page 404 /index.html;

location ~ /\. {
deny all;
}

}

root@srv543846:/etc/nginx/sites-available# nano laravel
server {
listen 80;
server_name championmaung.com www.championmaung.com; # Replace with your domain or IP

root /var/www/html/laravel_for_football/public;
index index.php index.html index.htm;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock; # Ensure the PHP version matches
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

-rw-rw-r-- 1 корневой корень 1217 22 июня 15:15 default.conf
lrwxrwxrwx 1 корневой корень 34 22 июня 08:13 flutter -> /etc /nginx/sites-available/flutter
lrwxrwxrwx 1 корень root 34 22 июня 13:13 laravel -> /etc/nginx/sites-available/laravel
root@srv543846: /etc/nginx/sites-enabled# nano default.conf
server {
if ($host = www.championmaung.com) {
return 301 https://$host$request_uri;
} # managed by Certbot

if ($host = championmaung.com) {
return 301 https://$host$request_uri;
} # managed by Certbot

listen 80;
listen [::]:80;
server_name championmaung.com www.championmaung.com api.championmaung.com;

return 301 https://$host$request_uri;

}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name championmaung.com www.championmaung.com;
ssl_certificate /etc/letsencrypt/live/championmaung.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/championmaung.com/privkey.pem; # managed by Certbot

root /var/www/html/web;
index index.html;

location / {
try_files $uri $uri/ =404;
}

error_page 404 /index.html;

location ~ /\. {
deny all;
}
location /api {
alias /var/www/html/laravel_for_football/public;
try_files $uri $uri/ /index.php?$query_string;

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
}

}


Подробнее здесь: https://stackoverflow.com/questions/786 ... untu-nginx

Вернуться в «Php»