Instalación servidor web Apache

    Instalación de un servidor web, Apache en Raspbian (Debian). Instalaremos el servidor web junto con PHP.

    apt update -y
    dpkg --configure -a
    apt --purge autoremove -y
    apt list --upgradable
    apt update -y
    
    apt install apache2 software-properties-common ca-certificates apt-transport-https gpg lsb-release openssl
    
    apt-get update
    apt-get upgrade
    apt-get autoremove
    apt-get autoclean
    apt-get clean
    
    usermod -a -G www-data pi
    chown -R -f www-data:www-data /var/www/html
    
    rm -rf /var/www/html/index.html
    
    sed -i 's/LogLevel warn/LogLevel debug/g' /etc/apache2/apache2.conf
    sed  's/^ServerName.*/ServerName ${hostname -s}/g' /etc/apache2/apache2.conf
    

    Instalaremos PHP, en caso de que lo necesitemos:

    apt install php7.3-cli php7.3
    apt install php7.3-common php7.3-curl php7.3-gd php7.3-mbstring php7.3-xml php7.3-zip php7.3-mysql libapache2-mod-php7.3 libapache2-mod-fcgid php7.3-fpm
    
    apt-get update
    apt-get upgrade
    apt-get autoremove
    apt-get autoclean
    apt-get clean
    
    a2enmod proxy_fcgi setenvif
    a2enconf php7.3-fpm
    a2enmod ssl
    a2enmod php7.3
    a2dismod php7.3
    

    Para validar la configuración,

    apache2ctl configtest
    php --version
    service apache2 restart
    
    echo "" > /var/www/html/node.php
    echo "" > /var/www/html/info.php
    
    chown -R -f www-data:www-data /var/www/html
    
    curl http://$(hostname -s)/node.php
    

    Leave a Reply

    Your email address will not be published. Required fields are marked *