Sign inSign up

h0perium/nginx-phpfpm

By h0perium

Updated about 1 year ago

nginx webserver + phpfpm to load php files

Image
0

1.1K

h0perium/nginx-phpfpm repository overview

Fast and simple run :
docker run -d -v /path/to/root/dir:/var/www/html/  --name nginx-phpfpm -p 80:80 h0perium/nginx-phpfpm

** you just replace the path with your own root web folder , by default the nginx accept any domain or address on specified port (80) , you can set your own nginx config file like bellow

docker run -d -v /path/to/root/dir:/var/www/html/ -v /path/to/nginx/conf:/etc/nginx/nginx.conf --name nginx-phpfpm -p 80:80 h0perium/nginx-phpfpm

API Mode

you can use these var to add and /api/ endpoint for your react app to the backend node or server app and also enable https: API_MODE , HTTPS , API_ENDPOINT , DOMAIN_NAME

docker run -d --net gamenet --restart=always -m 1g -e API_MODE=1 -e HTTPS=1 -e DOMAIN_NAME="example.com" -e API_ENDPOINT="backend-api-address:4000" -v /etc/myconfigs/website-khel/ssl/archive:/etc/nginx/ssl -v /path/to/htdocs/:/var/www/html/ --name my-nginx-phpfpm -p 80:80 h0perium/nginx-phpfpm

here is a nginx.conf example with phpfpm configs ready so you can edit it with your own configs file

events {
    worker_connections 1024;
}

http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    log_format main '$remote_addr - $remote_user [$time_local] "$request" '
                    '$status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for"';

    access_log /var/log/nginx/access.log main;

    sendfile on;
    keepalive_timeout 65;

    include /etc/nginx/conf.d/*.conf;

    server {
        listen 80;
        server_name -;

        root /var/www/html;
        index index.php;

        location / {
            try_files $uri $uri/ /index.php?$query_string;
        }

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

here is the complete project with files in github

https://github.com/h0perium/nginx-phpfpm

Tag summary

Content type

Image

Digest

sha256:de1e7bd34

Size

190.4 MB

Last updated

about 1 year ago

docker pull h0perium/nginx-phpfpm