You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your LAMP stack is now ready!! You can access it via `http://localhost`.
39
+
Your LAMP stack is now ready!! You can access it via `http://localhost`.
40
+
41
+
## Configuration and Usage
42
42
43
-
##Configuration and Usage
43
+
### General Information
44
44
45
-
### General Information
46
45
This Docker Stack is build for local development and not for production usage.
47
46
48
47
### Configuration
48
+
49
49
This package comes with default configuration options. You can modify them by creating `.env` file in your root directory.
50
50
To make it easy, just copy the content from `sample.env` file and update the environment variable values as per your need.
51
51
52
52
### Configuration Variables
53
+
53
54
There are following configuration variables available and you can customize them by overwritting in your own `.env` file.
54
55
55
56
---
57
+
56
58
#### PHP
59
+
57
60
---
61
+
58
62
_**PHPVERSION**_
59
-
Is used to specify which PHP Version you want to use. Defaults always to latest PHP Version.
63
+
Is used to specify which PHP Version you want to use. Defaults always to latest PHP Version.
60
64
61
65
_**PHP_INI**_
62
-
Define your custom `php.ini` modification to meet your requirments.
66
+
Define your custom `php.ini` modification to meet your requirments.
63
67
64
68
---
65
-
#### Apache
69
+
70
+
#### Apache
71
+
66
72
---
67
73
68
74
_**DOCUMENT_ROOT**_
@@ -84,15 +90,17 @@ _**APACHE_LOG_DIR**_
84
90
This will be used to store Apache logs. The default value for this is `./logs/apache2`.
85
91
86
92
---
93
+
87
94
#### Database
95
+
88
96
---
89
97
90
-
> For Apple Silicon Users:
91
-
Please select Mariadb as Database. Oracle doesn't build their SQL Containers for the arm Architecure
98
+
> For Apple Silicon Users:
99
+
> Please select Mariadb as Database. Oracle doesn't build their SQL Containers for the arm Architecure
92
100
93
101
_**DATABASE**_
94
102
95
-
Define which MySQL or MariaDB Version you would like to use.
103
+
Define which MySQL or MariaDB Version you would like to use.
96
104
97
105
_**MYSQL_INITDB_DIR**_
98
106
@@ -116,8 +124,8 @@ Apache is configured to run on port 80. So, you can access it via `http://localh
116
124
117
125
By default following modules are enabled.
118
126
119
-
* rewrite
120
-
* headers
127
+
- rewrite
128
+
- headers
121
129
122
130
> If you want to enable more modules, just update `./bin/phpX/Dockerfile`. You can also generate a PR and we will merge if seems good for general purpose.
123
131
> You have to rebuild the docker image by running `docker-compose build` and restart the docker containers.
@@ -136,22 +144,22 @@ The installed version of php depends on your `.env`file.
136
144
137
145
#### Extensions
138
146
139
-
By default following extensions are installed.
147
+
By default following extensions are installed.
140
148
May differ for PHP Versions <7.x.x
141
149
142
-
* mysqli
143
-
* pdo_sqlite
144
-
* pdo_mysql
145
-
* mbstring
146
-
* zip
147
-
* intl
148
-
* mcrypt
149
-
* curl
150
-
* json
151
-
* iconv
152
-
* xml
153
-
* xmlrpc
154
-
* gd
150
+
- mysqli
151
+
- pdo_sqlite
152
+
- pdo_mysql
153
+
- mbstring
154
+
- zip
155
+
- intl
156
+
- mcrypt
157
+
- curl
158
+
- json
159
+
- iconv
160
+
- xml
161
+
- xmlrpc
162
+
- gd
155
163
156
164
> If you want to install more extension, just update `./bin/webserver/Dockerfile`. You can also generate a PR and we will merge if it seems good for general purpose.
157
165
> You have to rebuild the docker image by running `docker-compose build` and restart the docker containers.
@@ -194,28 +202,28 @@ Example:
194
202
#xdebug.idekey=VSCODE
195
203
```
196
204
197
-
Xdebug VS Code: you have to install the Xdebug extension "PHP Debug". After installed, go to Debug and create the launch file so that your IDE can listen and work properly.
205
+
Xdebug VS Code: you have to install the Xdebug extension "PHP Debug". After installed, go to Debug and create the launch file so that your IDE can listen and work properly.
198
206
199
207
Example:
200
208
201
209
**VERY IMPORTANT:** the `pathMappings` depends on how you have opened the folder in VS Code. Each folder has your own configurations launch, that you can view in `.vscode/launch.json`
202
210
203
211
```json
204
212
{
205
-
"version": "0.2.0",
206
-
"configurations": [
207
-
{
208
-
"name": "Listen for Xdebug",
209
-
"type": "php",
210
-
"request": "launch",
211
-
// "port": 9000, // Xdebug 2
212
-
"port": 9003, // Xdebug 3
213
-
"pathMappings": {
214
-
// "/var/www/html": "${workspaceFolder}/www" // if you have opened VSCODE in root folder
215
-
"/var/www/html": "${workspaceFolder}"// if you have opened VSCODE in ./www folder
216
-
}
217
-
}
218
-
]
213
+
"version": "0.2.0",
214
+
"configurations": [
215
+
{
216
+
"name": "Listen for Xdebug",
217
+
"type": "php",
218
+
"request": "launch",
219
+
// "port": 9000, // Xdebug 2
220
+
"port": 9003, // Xdebug 3
221
+
"pathMappings": {
222
+
// "/var/www/html": "${workspaceFolder}/www" // if you have opened VSCODE in root folder
223
+
"/var/www/html": "${workspaceFolder}"// if you have opened VSCODE in ./www folder
224
+
}
225
+
}
226
+
]
219
227
}
220
228
```
221
229
@@ -227,15 +235,60 @@ Now, make a breakpoint and run debug.
227
235
228
236
It comes with Redis. It runs on default port `6379`.
229
237
238
+
## SSL (HTTPS)
239
+
240
+
Support for `https` domains is built-in but disabled by default. There are 3 ways you can enable and configure SSL; `https` on `localhost` being the easiest. If you are trying to recreating a testing environment as close as possible to a production environment, any domain name can be supported with more configuration.
241
+
242
+
**Notice:** For every non-localhost domain name you wish to use `https` on, you will need to modify your computers [hosts file](https://en.wikipedia.org/wiki/Hosts_%28file%29) and point the domain name to `127.0.0.1`. If you fail to do this SSL will not work and you will be routed to the internet every time you try to visit that domain name locally.
243
+
244
+
### 1) HTTPS on Localhost
245
+
246
+
To enable `https` on `localhost` (https://localhost) you will need to:
247
+
248
+
1. Use a tool like [mkcert](https://github.com/FiloSottile/mkcert#installation) to create an SSL certificate for `localhost`:
249
+
- With `mkcert`, in the terminal run `mkcert localhost 127.0.0.1 ::1`.
250
+
- Rename the files that were generated `cert.pem` and `cert-key.pem` respectively.
251
+
- Move these files into your docker setup by placing them in `config/ssl` directory.
252
+
2. Uncomment the `443` vhost in `config/vhosts/default.conf`.
253
+
254
+
Done. Now any time you turn on your LAMP container `https` will work on `localhost`.
255
+
256
+
### 2) HTTPS on many Domains with a Single Certificate
257
+
258
+
If you would like to use normal domain names for local testing, and need `https` support, the simplest solution is an SSL certificate that covers all the domain names:
259
+
260
+
1. Use a tool like [mkcert](https://github.com/FiloSottile/mkcert#installation) to create an SSL certificate that covers all the domain names you want:
261
+
- With `mkcert`, in the terminal run `mkcert example.com "*.example.org" myapp.dev localhost 127.0.0.1 ::1` where you replace all the domain names and IP addresses to the ones you wish to support.
262
+
- Rename the files that were generated `cert.pem` and `cert-key.pem` respectively.
263
+
- Move these files into your docker setup by placing them in `config/ssl` directory.
264
+
2. Uncomment the `443` vhost in `config/vhosts/default.conf`.
265
+
266
+
Done. Since you combined all the domain names into a single certificate, the vhost file will support your setup without needing to modify it further. You could add domain specific rules if you wish however. Now any time you turn on your LAMP container `https` will work on all the domains you specified.
267
+
268
+
### 3) HTTPS on many Domain with Multiple Certificates
269
+
270
+
If you would like your local testing environment to exactly match your production, and need `https` support, you could create an SSL certificate for every domain you wish to support:
271
+
272
+
1. Use a tool like [mkcert](https://github.com/FiloSottile/mkcert#installation) to create an SSL certificate that covers the domain name you want:
273
+
- With `mkcert`, in the terminal run `mkcert [your-domain-name(s)-here]` replacing the bracket part with your domain name.
274
+
- Rename the files that were generated to something unique like `[name]-cert.pem` and `[name]-cert-key.pem` replacing the bracket part with a unique name.
275
+
- Move these files into your docker setup by placing them in `config/ssl` directory.
276
+
2. Using the `443` example from the vhost file (`config/vhosts/default.conf`), make new rules that match your domain name and certificate file names.
277
+
278
+
Done. The LAMP container will auto pull in any SSL certificates in `config/ssl` when it starts. As long as you configure the vhosts file correctly and place the SSL certificates in `config/ssl`, any time you turn on your LAMP container `https` will work on your specified domains.
279
+
230
280
## Contributing
231
-
We are happy if you want to create a pull request or help people with their issues. If you want to create a PR, please remember that this stack is not built for production usage, and changes should be good for general purpose and not overspecialized.
232
-
> Please note that we simplified the project structure from several branches for each php version, to one centralized master branch. Please create your PR against master branch.
233
-
>
234
-
Thank you!
281
+
282
+
We are happy if you want to create a pull request or help people with their issues. If you want to create a PR, please remember that this stack is not built for production usage, and changes should be good for general purpose and not overspecialized.
283
+
284
+
> Please note that we simplified the project structure from several branches for each php version, to one centralized master branch. Please create your PR against master branch.
285
+
>
286
+
> Thank you!
235
287
236
288
## Why you shouldn't use this stack unmodified in production
237
-
We want to empower developers to quickly create creative Applications. Therefore we are providing an easy to set up a local development environment for several different Frameworks and PHP Versions.
289
+
290
+
We want to empower developers to quickly create creative Applications. Therefore we are providing an easy to set up a local development environment for several different Frameworks and PHP Versions.
238
291
In Production you should modify at a minimum the following subjects:
239
292
240
-
* php handler: mod_php=> php-fpm
241
-
* secure mysql users with proper source IP limitations
293
+
- php handler: mod_php=> php-fpm
294
+
- secure mysql users with proper source IP limitations
0 commit comments