HI can I ask some help please I want to run my PHP file “index.php” the content of this is only phpinfo(),
here is my command
docker run -it -p 8080:80 -v %cd%/code:/var/www/myapp myapp/jelo:latest php-fpm
after that when I visit browser the http://localhost:8080 , unable to connect
here is my Dockerfile
FROM php:7.4-fpm-alpine
#RUN docker-php-ext-install pdo
RUN docker-php-ext-install pdo_mysql
RUN apk update \
&& apk add --no-cache nginx --no-cache bash
COPY ./code /var/www/myapp
ADD default.conf /etc/nginx/conf.d/default.conf
EXPOSE 9000
CMD ["nginx", "-g", "daemon off;"]
Here is my defaut.conf
server {
listen 80;
index index.php;
server_name myapp.local;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/myapp;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_pass php-fpm:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}