Un serveur LAMP est un serveur Web basé sur Apache
L'acronyme LAMP signifie Linux Apache MySQL PHP :
~$ sudo apt install tasksel
~$ sudo tasksel
~$ sudo apt install {apache2,apache2-utils}
~$ sudo systemctl status apache2
S'il n’est pas démarré :
~$ sudo systemctl start apache2
~$ sudo systemctl enable apache2
~$ apache2 -v
~$ sudo apt install libncurses5
~$ sudo apt install {mariadb-server,mariadb-client}
~$ systemctl status mariadb
Si MariaDB n’est pas active, le lancer :
~$ sudo systemctl start mariadb
~$ sudo systemctl enable mariadb
~$ mariadb --version
~$ sudo apt install php-fpm
installe aussi les dépendances : php8.1-cli, php-common, php8.1-opcache, php8.1-readline
~$ php --version PHP 8.1.2-1ubuntu2.15 (cli)...
~$ sudo a2enmod proxy_fcgi setenvif
Modules activés à ce stade : access_compat.load alias.conf alias.load auth_basic.load authn_core.load authn_file.load authz_core.load authz_host.load authz_user.load autoindex.conf autoindex.load deflate.conf deflate.load dir.conf dir.load env.load filter.load mime.conf mime.load mpm_prefork.conf mpm_prefork.load negotiation.conf negotiation.load php8.1.conf php8.1.load proxy.conf proxy_fcgi.load proxy.load reqtimeout.conf reqtimeout.load setenvif.conf setenvif.load status.conf status.load vhost_alias.load
~$ sudo a2enconf php8.1-fpm
~$ sudo a2enmod vhost_alias ~$ sudo systemctl restart apache2
# fermier dokufarmer <VirtualHost *:80> ServerName dokufarmer.framboise4.parc DocumentRoot /var/www/html/framboise4/dokufarmer <Directory /var/www/html/> AllowOverride All Require all granted DirectoryIndex index.php index.html index.htm </Directory> <LocationMatch "/(data|conf|bin|inc|vendor)/"> Require all denied Satisfy All </LocationMatch> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> # sous-domaine ferme.framboise4.parc <VirtualHost *:80> ServerName ferme.framboise4.parc ServerAlias www.ferme.framboise4.parc DocumentRoot /var/www/html/dokuwiki <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/ferme.framboise4.parc_error.log CustomLog ${APACHE_LOG_DIR}/ferme.framboise4.parc_access.log combined </VirtualHost> # sous-domaine doc.framboise4.parc <VirtualHost *:80> ServerName doc.framboise4.parc ServerAlias www.doc.framboise4.parc DocumentRoot /var/www/html/dokuwiki php_admin_value post_max_size 1000M php_admin_value upload_max_filesize 1000M php_admin_value memory_limit 2000M # php_admin_value max_execution_time 360 # php_admin_value max_input_time 360 <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/doc.framboise4.parc_error.log CustomLog ${APACHE_LOG_DIR}/doc.framboise4.parc_access.log combined </VirtualHost> # sous-domaine doc1.framboise4.parc <VirtualHost *:80> <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> ServerName doc1.framboise4.parc ServerAlias www.doc1.framboise4.parc DocumentRoot /var/www/html/dokuwiki ErrorLog ${APACHE_LOG_DIR}/doc1.framboise4.parc_error.log CustomLog ${APACHE_LOG_DIR}/doc1.framboise4.parc_access.log combined </VirtualHost> # sous-domaine doc0.framboise4.parc <VirtualHost *:80> <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> ServerName doc0.framboise4.parc ServerAlias www.doc0.framboise4.parc DocumentRoot /var/www/html/doc0 ErrorLog ${APACHE_LOG_DIR}/doc0.framboise4.parc_error.log CustomLog ${APACHE_LOG_DIR}/doc0.framboise4.parc_access.log combined </VirtualHost> # sous-domaine perso.framboise4.parc <VirtualHost *:80> ServerName perso.framboise4.parc ServerAlias www.perso.framboise4.parc DocumentRoot /var/www/html/perso ErrorLog ${APACHE_LOG_DIR}/doc.framboise4.parc_error.log CustomLog ${APACHE_LOG_DIR}/doc.framboise4.parc_access.log combined <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost> # sous-domaine php.framboise4.parc <VirtualHost *:80> ServerName php.framboise4.parc ServerAlias www.php.framboise4.parc DocumentRoot /var/www/html/php ErrorLog ${APACHE_LOG_DIR}/php.framboise4.parc_error.log CustomLog ${APACHE_LOG_DIR}/php.framboise4.parc_access.log combined <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost> <VirtualHost *> ServerAlias *.framboise4.parc ServerAdmin root@localhost UseCanonicalName Off DocumentRoot /var/www/html VirtualDocumentRoot /var/www/html/%1 Options Indexes FollowSymLinks MultiViews ServerSignature Off ErrorLog /var/log/apache2/error.site.fr.log LogLevel warn CustomLog /var/log/apache2/access.log "%{%Y-%m-%d %H:%M:%S}t # %a # %>s # %f # %q # %H # %l # %m # %u # %b # \" %{User-agent}i\"" </VirtualHost>
~$ sudo chown www-data:www-data /var/www/html/ -R
~$ sudo apachectl -t AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message Syntax OK
Pour supprimer ce message d'erreur s'il se produit :
ServerName localhost
~$ sudo a2enconf servername.conf
~$ sudo systemctl reload apache2
~$ sudo apachectl -t Syntax OK
~$ sudo mysql_secure_installation ...Enter current password for root (enter for none):...Switch to unix_socket authentication [Y/n] ... Change the root password? [Y/n]New password: Re-enter new password:...Remove anonymous users? [Y/n] ... Disallow root login remotely? [Y/n] ... Remove test database and access to it? [Y/n] ... Reload privilege tables now? [Y/n]... Thanks for using MariaDB!
# chateau.parc <VirtualHost *:80> UseCanonicalName Off ServerName chateau.parc DocumentRoot /var/www/html <Directory /var/www/html/> Require all granted DirectoryIndex index.php index.html index.htm index.html.apache </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> # dolibarr.chateau.parc <VirtualHost *:80> UseCanonicalName Off ServerName dolibarr.chateau.parc VirtualDocumentRoot /var/www/html/%-3/htdocs <Directory /var/www/html/> Require all granted DirectoryIndex index.php index.html index.htm </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> ######### # Wikis # ######### # Ferme wiki.chateau.parc # fermier : chateau/fermier (wiki.chateau.parc) <VirtualHost *:80> UseCanonicalName Off ServerName wiki.chateau.parc ServerAlias *.wiki.chateau.parc VirtualDocumentRoot /var/www/html/chateau/fermier <Directory /var/www/html/chateau/> Require all granted DirectoryIndex index.php index.html index.htm </Directory> <LocationMatch "/(data|conf|bin|inc|vendor)/"> Require all denied Satisfy All </LocationMatch> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> # doc.chateau.parc, doc0.chateau.parc, doc-old.chateau.parc # essai.chateau.parc # perso.chateau.parc, perso-old.chateau.parc, perso0.chateau.parc # kine.chateau.parc # magie.chateau.parc <VirtualHost *:80> UseCanonicalName Off ServerName doc.chateau.parc ServerAlias doc*.chateau.parc ServerAlias essai.chateau.parc kine.chateau.parc magie.chateau.parc ServerAlias perso.chateau.parc perso*.chateau.parc VirtualDocumentRoot "/var/www/html/%-3" <Directory /var/www/html/> Require all granted DirectoryIndex index.php index.html index.htm </Directory> <LocationMatch "/(data|conf|bin|inc|vendor)/"> Require all denied Satisfy All </LocationMatch> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> # adminer.chateau.parc # glpi.chateau.parc # php.chateau.parc # awstats.chateau.parc <VirtualHost *:80> UseCanonicalName Off ServerName chateau.parc ServerAlias *.chateau.parc VirtualDocumentRoot "/var/www/html/%-3" <Directory /var/www/html/> #~ AllowOverride All Require all granted DirectoryIndex index.php index.html index.htm </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
~$ sudo a2ensite chateau.parc.conf ~$ sudo systemctl reload apache2.service