Simple PHP webpage


For a buddy of mine I was asked to host his website as well, his website uses PHP and a bit of javascript so all we really need on the server-side of things is a web-server that has php.

This will hook into the nginx-reverse proxy, so I need port 80 open, virtual host configured and letsencrypt host.

I made a folder for this project, put his source code in src and made the following docker-compose.yml:

version: "3.8"

services:
  server:
    image: webdevops/php-nginx:8.0
    volumes:
      - "./src:/app:z"
    environment:
       VIRTUAL_PORT: 80
       VIRTUAL_HOST: <websiteURL>
       LETSENCRYPT_HOST: <websiteURL>

Running the following command will start the container:

docker-compose up -d

Next we need to get it on the same network and make sure on the same network using:

docker network connect bridge <foldername>_server_1

then restart your nginx-proxy setup to let it reload your newly made website

Troubleshooting info

root folder of your php-website in the container is /app (as you can see in the volumes part of docker-compose.yml

relevant nginx-config location of the php-website container: /opt/docker/etc/nginx/vhost.conf

if your friend works on windows, please make sure to tell them to change ALL file-extensions to lowercase so that it will actually work (and preferably the start of each file as well, because it is much easier to work with)

I found this handy container-image via this medium article, note that you don’t have unlimited views of those articles.


Leave a Reply

Your email address will not be published.