Nginx server running with Docker for PHP applications.
With:
- Composer
- MySQL
- PHPMyAdmin
- NGNX PROXY
- Clone
- Move to ->
cd ${APP_NAME}
- Copy
.example.env
to.env
NOTICE: Update the values โโof the variables in .env
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 versionMYSQL_VERSION
:: MySQL version
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
-
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 ancomposer.json
file in app/ -
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>
-
Open your browser:
- http://${NGINX_HOST} Your App
- http://db.${NGINX_HOST} AdminDB:: Manage your database.
-
Stop and clear services
docker-compose down -v
run/backup.sh
run/restore.sh