Jump to content

Docker Prestashop FPM + Nginx | 1: HTTP 500 - error - {"success":true,"message":""}


Recommended Posts

Hi,

I am getting an error 500 when trying to install Prestashop 8.1.1 FPM via Docker and nginx proxy. Somehow can't get the official Docker image run correctly. Just after solving Error 504 I get the 500...

1: HTTP 500 - error - {"success":true,"message":""}

 

Running Docker on MacOS Ventura 13.4.1, 2023 M2 Pro. Self-signed certificates as it's a dev environment only.

 

image.thumb.png.7c4101a77adb2a36e39100d99489f1d8.png

prestashop                 | 172.21.0.4 -  24/Aug/2023:19:14:22 +0000 "GET /install/index.php" 200
prestashop                 | NOTICE: PHP message: PHP Warning:  require(/var/www/html/var/cache/pro_/ContainerG9hCANY/getConsole_CommandLoaderService.php): Failed to open stream: No such file or directory in /var/www/html/var/cache/pro_/ContainerG9hCANY/appAppKernelProdContainer.php on line 2254
prestashop                 | NOTICE: PHP message: PHP Fatal error:  Uncaught Error: Failed opening required '/var/www/html/var/cache/pro_/ContainerG9hCANY/getConsole_CommandLoaderService.php' (include_path='/var/www/html/vendor/pear/pear_exception:/var/www/html/vendor/pear/console_getopt:/var/www/html/vendor/pear/pear-core-minimal/src:/var/www/html/vendor/pear/archive_tar:.:/usr/local/lib/php') in /var/www/html/var/cache/pro_/ContainerG9hCANY/appAppKernelProdContainer.php:2254
prestashop                 | Stack trace:
prestashop                 | #0 /var/www/html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php(255): ContainerG9hCANY\appAppKernelProdContainer->load('getConsole_Comm...')
prestashop                 | #1 /var/www/html/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php(231): Symfony\Component\DependencyInjection\Container->make('console.command...', 1)
prestashop                 | #2 /var/www/html/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(184): Symfony\Component\DependencyInjection\Container->get('console.command...')
prestashop                 | #3 /var/www/html/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(75): Symfony\Bundle\FrameworkBundle\Console\Application->registerCommands()
prestashop                 | #4 /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(149): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\NullOutput))
prestashop                 | #5 /var/www/html/src/Adapter/Cache/Clearer/SymfonyCacheClearer.php(79): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\NullOutput))
prestashop                 | #6 [internal function]: PrestaShop\PrestaShop\Adapter\Cache\Clearer\SymfonyCacheClearer->PrestaShop\PrestaShop\Adapter\Cache\Clearer\{closure}()
prestashop                 | #7 {main}
shop-nginx-1               | 172.21.0.1 - - [24/Aug/2023:19:15:23 +0000] "GET /install/index.php?installTheme=true&_=1692904423324 HTTP/2.0" 500 29 "https://localhost/install/index.php" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36" "-"
prestashop                 |   thrown in /var/www/html/var/cache/pro_/ContainerG9hCANY/appAppKernelProdContainer.php on line 2254

I can see that there is no "pro_" folder inside my /var/cache. There is one called "prod" tho, maybe that's the issue?

 

Docker-compose.yml:

version: '3'
services:

  nginx:  # Nginx web server
    image: nginx:latest  # Latest Nginx Server Image
    restart: unless-stopped
    depends_on:
      - prestashop
    ports:
      - 80:80
      - 443:443
    networks:
      - prestashop_network
    volumes:
      - ./src:/var/www/html  # Mount the local src directory to the container
      - ./nginx.conf:/etc/nginx/conf.d/default.conf  # Mount the Nginx config
      - ./ssl:/etc/nginx/ssl  # Mount the SSL folder to provide certs

  mysql:  # MySQL DB
    container_name: mysql
    image: mysql:latest  # Latest MySQL Server Image
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWD}  # MySQL Root Password
      MYSQL_DATABASE: ${MYSQL_DATABASE}  # Project's database
      MYSQL_USER: ${MYSQL_USER}  # Project's database user
      MYSQL_PASSWORD: ${MYSQL_USER_PASSWD}  # Project's database password
    ports:
      - 3306:3306
    networks:
      - prestashop_network
    volumes:
      - mysql-data:/var/lib/mysql  # Mount the MySQL data volume

  prestashop:  # Prestashop Shop CMS
    container_name: prestashop
    # image: prestashop/prestashop:latest  # Latest Prestashop Apache Image
    image: prestashop/prestashop:8.1.1-8.1-fpm  # FPM Nginx Prestashop Image
    restart: unless-stopped
    depends_on:
      - mysql
    environment:
      PS_DEV_MODE: ${PS_DEV_MODE} # Development mode
      PS_INSTALL_AUTO: ${PS_INSTALL_AUTO}  # Install Prestashop automatically
      PS_INSTALL_DB: ${PS_INSTALL_DB}  # Create DB on install
      PS_ERASE_DB: ${PS_ERASE_DB}  # Erase DB on install
      PS_ENABLE_SSL: ${PS_ENABLE_SSL}  # Enable SSL on install
      PS_DOMAIN: ${PS_DOMAIN}  # Domain for Prestashop installation
      DB_SERVER: ${PS_DATABASE_SERVER}  # Project's database server
      DB_NAME: ${PS_DATABASE}  # Project's database
      DB_USER: ${PS_DATABASE_USER}  # Project's database user
      DB_PASSWD: ${PS_DATABASE_PASSWD}  # Project's database password
      ADMIN_MAIL: ${PS_ADMIN_MAIL}  # Prestashop admin email
      ADMIN_PASSWD: ${PS_ADMIN_PASSWD}  # Prestashop admin password
      PS_FOLDER_ADMIN: ${PS_FOLDER_ADMIN}  # Prestashop admin folder/url
    networks:
      - prestashop_network
    volumes:
      - ./src:/var/www/html  # Mount the local src directory to the container

networks:
  prestashop_network:  # Define a shared network for this setup

volumes:
  mysql-data:  # Define the MySQL data volume

 

nginx.conf:

server {
   server_name localhost;

   location / {
       return 301 https://$host$request_uri;
   }
}

server {
   listen 443 ssl;
   http2 on;
   server_name localhost;

   ssl_protocols TLSv1.2 TLSv1.3;
   ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
   ssl_prefer_server_ciphers off;

   ssl_session_timeout 1d;
   ssl_session_cache shared:MozSSL:10m;
   ssl_session_tickets off;

   ssl_certificate /etc/nginx/ssl/server.crt;
   ssl_certificate_key /etc/nginx/ssl/server.key;

   index index.php index.html;
   root /var/www/html;
   location ~ \.php$ {
       try_files $uri =404;
       fastcgi_split_path_info ^(.+\.php)(/.+)$;
       fastcgi_pass prestashop:9000;
       fastcgi_index index.php;
       include fastcgi_params;
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
       fastcgi_param PATH_INFO $fastcgi_path_info;
       fastcgi_read_timeout 600;
       proxy_connect_timeout 600;
       proxy_send_timeout 600;
       proxy_read_timeout 600;
       send_timeout 600;
   }
}

 

Edited by exepowered
Formatting. (see edit history)
Link to comment
Share on other sites

  • exepowered changed the title to Docker Prestashop FPM + Nginx | 1: HTTP 500 - error - {"success":true,"message":""}
  • 4 weeks later...
13 hours ago, Johnwickoff said:

Installing via GCI. Does it work on every single one or just macs. I am using windows only.

 

 

 

 

 

It should work on every system, but requires some dependencies I guess. Using docker and the original Prestashop-FPM image it's possible from the container console.

Link to comment
Share on other sites

  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...