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
{{ message }}
Repository navigation
Commit 87c3bbb
Browse filesBrowse the repository at this point in the historyBrowse files
Enhance documentation on default configurations to emphasize security practices of running containers as non-root users. Added sections on implications for web server ports and file permissions, along with recommended methods for running services on standard HTTP/HTTPS ports.
Copy file name to clipboardExpand all lines: docs/content/docs/1.getting-started/5.default-configurations.md
+36-8Lines changed: 36 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,13 +12,21 @@ layout: docs
12
12
All values are defaulted to improve security and performance. We also spent the time to carefully review official documentation and include packages that are required specifically for Laravel and WordPress.
13
13
14
14
## Unprivileged by Default
15
-
All images default to running as the OS-native `www-data` user.
16
15
17
-
::note
18
-
The `www-data` UID/GID is different between Debian (`33:33`) and Alpine (`82:82`). We left these values alone to make these images as native as possible. If you switch between Debian and Alpine, you may need to adjust file permissions in your Docker image and volume mounts.
19
-
::
16
+
All images default to running as the OS-native `www-data` user instead of `root`. This is a critical security practice that limits what an attacker can do if they compromise your container.
17
+
18
+
### Why this matters
19
+
Running as a non-root user means:
20
+
21
+
-**Better security**: If someone exploits a vulnerability in your app, they can't gain root access to your container or host system
22
+
-**Production-ready**: This follows Docker and Kubernetes security best practices
23
+
-**Easier compliance**: Many security policies require non-root containers
20
24
21
-
Since these images are not privileged, that means they are not running on ports less than 1024:
25
+
### What this means for you
26
+
Running unprivileged has two practical implications you should know about:
27
+
28
+
#### Different ports for web servers
29
+
On Linux systems, only root can bind to ports below 1024 (like 80 and 443). Since our containers don't run as root, they use higher port numbers by default:
22
30
23
31
|**Variation**|**Default Ports**|
24
32
|---------------|-------------------|
@@ -29,15 +37,35 @@ Since these images are not privileged, that means they are not running on ports
29
37
| unit | HTTP: 8080, HTTPS: 8443 |
30
38
| frankenphp | HTTP: 8080, HTTPS: 8443 |
31
39
32
-
### How do I run these services on ports 80 and/or 443?
33
-
Almost everyone will want to run these services on ports 80 and 443. If you have an advanced setup, you can use a reverse proxy like Caddy or Traefik to handle the SSL termination and forward the traffic to the container on the non-privileged port.
40
+
#### File permissions to be aware of
41
+
The `www-data` user has different IDs depending on your base operating system:
42
+
-**Debian**: UID/GID `33:33`
43
+
-**Alpine**: UID/GID `82:82`
44
+
45
+
::tip
46
+
We kept these as the OS defaults to maintain compatibility with other tools and images. If you're mounting volumes from your host machine or switching between Debian and Alpine, you might need to adjust file permissions.
47
+
::
48
+
49
+
### Running on standard HTTP/HTTPS ports (80 and 443)
50
+
Don't worry—you have two easy options to run your app on the standard web ports:
34
51
35
-
Or you can simply use Docker's port mapping feature to map the container port to the host port. For example, to run the `fpm-nginx` variation on port 80 and 443, you can run the following command:
52
+
#### Docker port mapping (recommended for development)
53
+
Use Docker's built-in port mapping to route traffic from port 80/443 on your host to the container's higher ports:
36
54
37
55
```bash [Terminal]
38
56
docker run -p 80:8080 -p 443:8443 serversideup/php:8.4-fpm-nginx
39
57
```
40
58
59
+
This tells Docker: "Take traffic coming to port 80 on my machine and send it to port 8080 in the container."
60
+
61
+
#### Reverse proxy (recommended for production)
62
+
Use a reverse proxy like [Caddy](https://caddyserver.com/){target="_blank"}, [Traefik](https://traefik.io/){target="_blank"}, or [NGINX](https://nginx.org/){target="_blank"} to handle SSL certificates and route traffic to your containers. This is the preferred approach for production because it:
63
+
- Automatically handles SSL certificate generation and renewal
64
+
- Can route to multiple containers/services
65
+
- Provides additional security features like rate limiting
66
+
67
+
:u-button{to="/docs/deployment-and-production/configuring-ssl"label="Learn about SSL configuration"aria-label="Learn about SSL configuration"size="md"color="primary"variant="outline"trailing-icon="i-lucide-arrow-right"class="font-bold ring ring-inset ring-blue-600 text-blue-600 hover:ring-blue-500 hover:text-blue-500"}
68
+
41
69
## Default Environment Variables
42
70
Environment variables give you a ton of flexibility to customize your container without the complexity of mounting custom configuration files. By default, these images are set to production-ready values. You can read more about the available environment variables below.
0 commit comments