Web Server for ARM64 on Alpin-OS ( PHP Version 8.3.3 MariaDB Version 10.5 NGINX/1.25.4) PHPMyAdmin
106
webserveralpine
- Dockerfile
- docker-compose.yml
- index.php
- nginx.conf
- web/
Download
git clone https://github.com/otnamrehus/webserveralpin.git
Execution Docker
docker run --name webserveralpine --restart=always --hostname webserveralpine -p 7080:80 -p 7081:80 -p 3307:3306 -d masihgurutkj/webserveralpine:arm64.1.0
Dockerfile
#Gunakan base image resmi Nginx yang berjalan di Alpine Linux
FROM nginx:alpine
#Salin file konfigurasi Nginx ke dalam container
COPY nginx.conf /etc/nginx/nginx.conf
#Expose port 80 untuk akses web
EXPOSE 80
#Command untuk menjalankan Nginx ketika container dijalankan
CMD ["nginx", "-g", "daemon off;"]
docker-compose.yml
version: '3'
services:
nginx:
image: arm64v8/nginx:alpine
container_name: webserver
volumes:
- ./web:/var/www/html
- ./nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "7080:80"
depends_on:
- php
php:
image: arm64v8/php:fpm-alpine
#image: arm64v8/php:7.4-alpine
container_name: php-fpm
volumes:
- ./web:/var/www/html
depends_on:
- mariadb
mariadb:
image: arm64v8/mariadb:10.5
container_name: mariadb
environment:
MYSQL_ROOT_PASSWORD: root_toor
MYSQL_DATABASE: mysql
MYSQL_USER: user
MYSQL_PASSWORD: user_resu
ports:
- "3307:3306" # Ganti port dari 3306 ke 3307
phpmyadmin:
image: arm64v8/phpmyadmin:latest
environment:
PMA_HOST: mariadb
MYSQL_ROOT_PASSWORD: root_password
MYSQL_USER: user
MYSQL_PASSWORD: user_password
ports:
- "7081:80"
depends_on:
- mariadb
nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
server {
listen 80;
server_name otnamrehus.my.id;
root /var/www/html; # Sesuaikan dengan lokasi root situs Anda
index index.php index.html index.htm; # Sesuaikan dengan urutan file indeks yang Anda inginkan
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# Pengaturan PHP-FPM
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass php:9000; # Mengarahkan ke service php
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
# Pengaturan untuk file yang diawali dengan titik (.) - contohnya .htaccess
location ~ /\.ht {
deny all;
}
# Pengaturan untuk halaman error
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
index.php
<?php
phpinfo();
?>
Directory 'web'
mkdir -p web
Build docker-compose
docker build -t webserveralpine .
#or use it
docker build --platform linux/arm64 -t webserveralpine . #opsional use "-platform linux/arm64"
Run [Stack] docker-compose
docker-compose -p 'webserveralpine' up --build
Stop [Stack] docker-compose
docker-compose -p 'webserveralpine' stop # or use CTRL+C on Console
Clear [Stack] docker-compose
docker-compose -p 'webserveralpine' down
Web
http://IP_ADDRESS:7080
PHPMyAdmin
http://IP_ADDRESS:7081
Content type
Image
Digest
sha256:50f6d31f6…
Size
16.8 MB
Last updated
over 2 years ago
docker pull masihgurutkj/webserveralpine