Skip to content

An Phusion (Ubuntu), Nginx and PHP7 stack Built in Docker

License

Notifications You must be signed in to change notification settings

velmie/ubuntu-nginx-php7

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ubuntu-nginx-php7

A Nginx + PHP 7.2 (FPM) base container. Builds upon on the Ubuntu 16.04 LTS unsing phusion/baseimage-docker container. You can find the docker automated build here.

Services

All services are defined and managed using the phusion/baseimage methodology. Logs are output using syslog and can be accessed using docker logs {container}.

  • Nginx (lastest)
  • PHP-FPM (7.2)
  • Composer (PHP)
  • XTERM environment support w/colors
  • NodeJs 10

Default Settings

The container sets up a www root folder in the following location:

/var/www/public

As a final task a demo index.php is copied to this location.

Add SFTP user

Create a regular user

create_sftp_user -u username -p password

Permissions fix (/var/www)

fix_www_permissions

By default, the system runs this script every hour.

To disable it, just edit the /etc/crontab file.

Manage services

sv (start|stop|restart) nginx

More information

Web Root

The following folder is specified as the default root web folder:

/var/www/public

Note that the /var/www/public is the root folder for serving PHP files for your web server.

Example

$ docker run -p 3306:3306 --name my_mysql -e MYSQL_ROOT_PASSWORD=mysecretpassword -d mysql $ docker run -p 3306:3306 --name my_postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres

This will create a my_mysql or my_postgres image based on official mysql or postgres docker image.

docker run -p 80:80 -p 9000:9000 --name my_laravel -v ~/dev/laravel:/var/www --link my_mysql:mysqldb -d velmie/ubuntu-nginx-php7

This will create a docker image with name my_laravel linked to the MySQL container (my_mysql). Configue Laravel to connect to mysqldb host on .env file to access the database.

Now you can access your project on browser http://localhost

In the future to start the project again run:

docker start my_mysql my_laravel

To stop just run: docker stop my_laravel my_mysql

Build Folder (within repo)

Contains nginx config files (nginx.conf) as well the scripts to configure php-fpm nginx, also include setup.sh file that offloads tasks from the Dockerfile to reduce layers.

Databases

This image supports PostgreSQL and MySQL and/or MariaDB.

Timezone

The machine is configured to user UTC timezone. The Nginx configuration is ready to run a Laravel app.

About

An Phusion (Ubuntu), Nginx and PHP7 stack Built in Docker

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 64.7%
  • Dockerfile 35.1%
  • PHP 0.2%