Git Product home page Git Product logo

nginx-server-docker's Introduction

Nginx Server for PHP Apps with MySQL ๐Ÿš€

Nginx server running with Docker for PHP applications.
With:

  • Composer
  • MySQL
  • PHPMyAdmin
  • NGNX PROXY

Install ๐Ÿ“Œ


Getting Started ๐Ÿ“Œ


  1. Clone
  2. Move to -> cd ${APP_NAME}
  3. Copy .example.env to .env

NOTICE: Update the values โ€‹โ€‹of the variables in .env

Env vars ๐Ÿ“Œ


  • APP_NAME :: Name of your application. NOTICE: Please use uppercase and underscores.
  • NGINX_HOST :: Route where your application will live. example :: myapp.local
  • DB_PASSWORD :: Database pass.
  • DB_USER :: Database user.
  • DB_NAME :: The database name used by the application.
  • DB_HOST :: Name of the service where MySQL runs. default :: db
  • PHP_VERSION :: PHP version
  • MYSQL_VERSION :: MySQL version

Edit hosts file ๐Ÿ“Œ

You must add the route "${NGINX_HOST}" where your application lives to the hosts file located at:

C:\Windows\System32\drivers\etc\hosts

NOTICE: Add your route and add another version with the prefix db.

Warning: Just edit the part of the myapp.local || ${NGINX_HOST} route

Examples

127.0.0.1 ${NGINX_HOST}
127.0.0.1 db.${NGINX_HOST}
127.0.0.1 myapp.local
127.0.0.1 db.myapp.local

Run the application โš™๏ธ


  1. Copy your entire App to the app/ directory.

    1.1 Make sure you have an index.php file in app/
    1.2 Make sure you have an composer.json file in app/

  2. Start the application:
    Note: root of main directory ./ not in ./app/

    docker-compose up -d

    Please wait this might take a several minutes...

    docker-compose logs -f # Follow log output

    2.1 See logs of a specific container:

     ```sh
     docker logs <CONTAINER_NAME>
     ```
    

    2.1 Example: <MY_APP_SERVER> <MY_APP_MY_SQL_ADMIN>

  3. Open your browser:

  4. Stop and clear services

    docker-compose down -v

Scripts

Creating a backup of single database

run/backup.sh

Restoring a backup of single database

run/restore.sh

nginx-server-docker's People

Contributors

efraa avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.