Gå til hovedindhold
50% rabat alle planer, tidsbegrænset. Fra $2.48/mo
LAMP

LAMP

LAMP er den klassiske Linux + Apache + MySQL + PHP-stack, forudkonfigureret. Den webstack der drev størstedelen af internettet i 00'erne og stadig kører WordPress, Joomla, Drupal og 80% af alle delte hostingsider. Standardvalget til traditionelle PHP-applikationer.

Overblik

2.9k

GitHub-stjerner

38

Sidevisninger

320

Aktive installationer

Licens GPL-3.0 Udgave Latest OS Ubuntu Server 24.04 LTS, Ubuntu Server 22.04 LTS Min RAM 1 GB IP IPV4,IPV6

Aktive installationer er eksempeldata (forhåndsvisning); den rigtige metrik tilsluttes inden lancering.

Installerede tjenester

  • Apache-webserver → /var/www/html
  • MySQL Server (sikret) → Root-legitimationsoplysninger gemt i /root/.cloudzy-creds
  • PHP & udvidelser → Inkluderer php-fpm, php-mysql, php-opcache, php-cli, php-curl, php-mbstring, php-xml, php-zip, php-gd

Vigtige filer og mapper

  • Gemt MySQL root-adgangskode: /root/.cloudzy-creds
  • Apache web-rodmappe: /var/www/html
  • Apache-konfigurationsfiler: /etc/apache2
  • MySQL konfigurationsfiler: /etc/mysql
  • MySQL databasefiler: /var/lib/mysql
  • Apache-logs: /var/log/apache2
  • MySQL-logge: /var/log/mysql
  • PHP-FPM-stik: /run/php/php-fpm.sock

Få adgang til MySQL

Log ind som root:

mysql -u root -p

Adgangskode gemmes i /root/.cloudzy-creds.

Almindelige kommandoer:

SHOW DATABASES;                                              -- List all databases
USE <database>;                                              -- Switch to a specific database
CREATE DATABASE mydb;                                        -- Create a new database
CREATE USER 'appuser'@'localhost' IDENTIFIED BY 'password';  -- Create a new user
GRANT ALL PRIVILEGES ON mydb.* TO 'appuser'@'localhost';     -- Grant privileges
EXIT;                                                        -- Quit MySQL shell

Få adgang til Apache

Webrod: /var/www/html

Konfigurationstest:

sudo apache2ctl configtest

Adgang i browser: http://<SERVER_IP>

Brug PHP

Opret en fil /var/www/html/hello.php med:

<?php

echo "Hello World!";

?>

Se i browser: http://<SERVER_IP>/hello.php

Service-håndtering

Apache:

sudo systemctl status apache2    # Check status
sudo systemctl restart apache2   # Restart service

MySQL:

sudo systemctl status mysql      # Check status
sudo systemctl restart mysql     # Restart service

PHP-FPM:

PHP_FPM_VERSION=$(ls /etc/php | grep -E '^[0-9]+\.[0-9]+$')
PHP_FPM_SERVICE="php${PHP_FPM_VERSION}-fpm"
systemctl status ${PHP_FPM_SERVICE}
systemctl restart ${PHP_FPM_SERVICE}

Mere inden for webhosting

Relaterede apps.

Deploy LAMP nu. Fra 2,48 $/md.