Welcome! Log In Create A New Profile

Advanced

Localhost sent an invalid response. ERR_INVALID_HTTP_RESPONSE

Posted by mo100 
Localhost sent an invalid response. ERR_INVALID_HTTP_RESPONSE
March 16, 2023 05:49PM
Hello,

Nginx + php + MariaDB with Docker.

I am setting up php environment locally on my windows 10 machine with Docker. I was able to set up everything just fine. I am able to see the contents from index.php. However, I am getting one error when I go to the URL to access the database.

> # This page isn’t working
>
> **localhost** sent an invalid response.
>
> ERR_INVALID_HTTP_RESPONSE

docker-compose.yml

```
version: '3'
services:
web:
image: nginx:latest
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/conf.d/nginx.conf
- ./app:/app
php:
build:
context: .
dockerfile: PHP.Dockerfile
volumes:
- ./app:/app
mysql:
image: mariadb:latest
environment:
MYSQL_ROOT_PASSWORD: 'secret'
MYSQL_USER: 'tutorial'
MYSQL_PASSWORD: 'secret'
MYSQL_DATABASE: 'tutorial'
volumes:
- mysqldata:/var/lib/mysql
ports:
- 3307:3306
volumes:
mysqldata: {}
```
nginx.conf

```
server {
listen 80 default_server;
root /app/public;

# listen 443 ssl http2;
server_name localhost;

index index.php index.html index.htm;

location ~ \.php$ {
fastcgi_pass php:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
```

PHP.dockerfile

```
FROM php:fpm

RUN docker-php-ext-install pdo pdo_mysql

RUN pecl install xdebug && docker-php-ext-enable xdebug
```
I get the above mentioned error when I make a request at this URl
http://localhost:3307

How can I fix the error?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 69
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready