بک اند پروژه من لاراول و فرانت اند نکست جی اس هست و من این پروژه رو داکرایز کردم و روی سرور لینوکسی گداشتم nginx+php+docker
وقتی یه چیزی روبا پست میفرستم post همون رو قبل از response من میزاره بهم میده و این بعضی وقتا هست فقط
Request: { "email": "xxx@gmail.com", "password": "xxxxxxx" }
Response: { "email": "xxx@gmail.com", "password": "xxxxxxx" }{ "token": "xxxxxxxxxxxxxxxxxxxxxxxxxx", "type": "xxxxxxxx" }
این مشکل اکثر اوقات پیش نمیاد ولی خب از یه زمانی به بعد همش این مشکل تکرار میشه یعنی وقتی پروژه رو restart می کنم مشکل موقتا حل میشه
این کد docker-compose منه
services:
nginx:
build:
context: .
dockerfile: ./docker/nginx/Dockerfile
container_name: nginx
ports:
- "80:80"
- "443:443"
volumes:
- ./docker/nginx/conf.d:/etc/nginx/conf.d
- ./docker/nginx/certs:/etc/letsencrypt:ro
- ./backend:/var/www/html
- ./frontend:/app
- ./docker/nginx/.htpasswd:/etc/nginx/.htpasswd
depends_on:
- backend
- frontend
networks:
- app-network
backend:
build:
context: .
dockerfile: ./docker/php/Dockerfile
container_name: backend
ports:
- "9000:9000" # Map backend to host port 9000
- "6001:6001" # WebSocket default
volumes:
- "./backend:/var/www/html"
networks:
- app-network
depends_on:
- db
queue:
build:
context: .
dockerfile: ./docker/php/Dockerfile
command: php artisan queue:work
depends_on:
- backend
restart: always
volumes:
- "./backend:/var/www/html"
networks:
- app-network
frontend:
build:
context: .
dockerfile: ./docker/nextjs/Dockerfile
container_name: frontend
ports:
- "3000:3000" # Map frontend to host port 3000
working_dir: /app
volumes:
- "./frontend:/app"
networks:
- app-network
depends_on:
- backend
db:
image: mysql:8.0
container_name: db
ports:
- "3306:3306" # Map MySQL to host port 3306
environment:
MYSQL_ROOT_PASSWORD: root_password
MYSQL_DATABASE: laravel_docker
MYSQL_USER: user
MYSQL_PASSWORD: user_password
networks:
- app-network
volumes:
- ./docker/db/data:/var/lib/mysql
- ./docker/db/backup:/backup
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: root_password
ports:
- "8080:80"
networks:
- app-network
volumes:
db-data:
db-backup:
networks:
app-network:
driver: bridge
و این کد کانفیگ nginx من برای php
# Redirect all HTTP requests to HTTPS
server {
listen 80;
server_name mydomain;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name mydomain;
# Laravel public directory
root /var/www/html/public;
index index.php index.html;
ssl_certificate /etc/letsencrypt/mydomain.crt;
ssl_certificate_key /etc/letsencrypt/mydomain.key;
# ===================
# Main application routes
# ===================
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# ===================
# PHP-FPM handling for Laravel
# ===================
location ~ \.php$ {
# Pass requests to the PHP-FPM container
include fastcgi_params;
fastcgi_pass backend:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
}
# ===================
# Security: block hidden and system files
# ===================
location ~ /\.(?!well-known).* {
deny all;
}
}
به رامین فرامرزی کمک کنید تا مشکل خودش را حل کند؛ اینطور میتوانیم با هم پیشرفت کنیم.
آیا مایل به ارسال نوتیفیکیشن و اخبار از طرف راکت هستید ؟