Answer the question
In order to leave comments, you need to log in
Where did docker-compose NGINX-php-fpm-postgres go wrong?
Plz tell me what I have not completed, there is also a problem, when opening localhost, the nginx page opens, and the php
Nginx information page should open. Port 80 must be forwarded out. The config file must be forwarded from outside. The web directory must be forwarded from outside.
php-fpm. The web directory must be forwarded from outside. Configuration files must be forwarded from outside. Additionally, php-memcached, php-ldap, php-amqp must be installed.
memcached.
postgres. Port 5432 must be forwarded out. The config file must be forwarded from outside. The database directory must be forwarded from outside.
Administrator. Port 8080 must be forwarded out.
Stack check:
Open an address in a browser (for example, localhost/). The php information page should be displayed. To do this, the index.php file with the content <?php phpinfo(); must be in the web directory; ?>. On the page, we make sure that the specified modules are installed and connected: php-memcached, php-ldap, php-amqp.
Open the address in the browser (for example, localhost:8080/). Should get into the Adminer interface. Enter credentials to connect to the database. Should successfully connect to the database.
nginx.conf
server {
listen 127.0.0.1:80;
server_name localhost;
index index.php;
root /var/www/deck/fpm;
error_log /var/log/nginx/error.log;
location / {
try_files $uri /$uri /index.php?query_string;
}
location ~* \.php$ {
try_files $uri $uri/ /index.php last;
fastcgi_split_path_info (.+?\.php)(/.*)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location ~* .php/ { rewrite (.*.php)/ $1 last; }
}
FROM php:7.4-fpm
RUN apt-get update \
&& apt-get install -y \
&& apt-get install -y memcached \
&& apt-get install -y libldap2-dev \
apt-utils \
curl \
libpq-dev \
&& docker-php-ext-install -j$(nproc) pgsql \
&& docker-php-ext-install -j$(nproc) pdo_pgsql \
version: '3.8'
services:
nginx:
image: nginx:latest
ports:
- 80:80
links:
- fpm
volumes:
- ./www:/var/www/fpm
fpm:
build:
context: .
dockerfile: fpm/Dockerfile
volumes:
- ./www:/var/www/fpm
links:
- postgres
postgres:
image: postgres
ports:
- 5432:5432
environment:
- POSTGRES_DB=root
- POSTGRES_USER=root
- POSTGRES_PASSWORD=root
adminer:
image: adminer
restart: always
ports:
- 8080:8080
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question