diff --git a/2/SRI/exams/examen-nortega.txt b/2/SRI/exams/examen-nortega.txt new file mode 100644 index 0000000..3f85885 --- /dev/null +++ b/2/SRI/exams/examen-nortega.txt @@ -0,0 +1,168 @@ +================================ +*** Ejercicio Apache Examen *** +*** --- *** +*** Nicolás A. Ortega Froysa *** +================================ + +# Formato +--------- +Dónde poner los comandos: +[máquina:usuario] + +Salida de un comando: +``` + +``` + +# Paso I: Instalación de SSH y Apache +------------------------------------- + +[servidor:root] +# Instalar OpenSSH (sshd) +apt install openssh-server +# Comprobar funcionamiento de sshd +systemctl status sshd + +[cliente:-] +# decir que sí a reconocer el host y entrar con la contraseña +ssh examen@172.16.40.26 + +# usar `su -` para entrar como root +[servidor:root] (via ssh para el resto del examen) +# instalar apache2 +apt update +apt install apache2 +# comprobar funcionamiento de apache2 +apt install curl +curl localhost +# configurar dominio examen.es +echo "127.0.0.1 examen.es" >> /etc/hosts + +[cliente:root] +echo "172.16.40.26 examen.es" >> /etc/hosts + +[servidor:root] +cd /etc/apache2/sites-available/ +cp 000-default.conf examen.es.conf +# editar el archivo para que salga como aparece en el `cat` +vi examen.es.conf +cat examen.es.conf +``` + + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + ServerName examen.es + + ServerAdmin webmaster@localhost + DocumentRoot /var/www/html + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + +``` +cd ../sites-enabled/ +rm 000-default.conf +ln -s ../sites-available/examen.es.conf examen.es.conf +systemctl restart apache2 +echo "Mi HTML" > /var/www/html/index.html + +[cliente:-] +curl examen.es +``` +Mi HTML +``` + +[servidor:root] +mkdir /home/examen.es +echo "Bienvenido a tu examen" > /home/examen.es/indice.html +echo "Error 404..." > /home/examen.es/error403.html +mkdir /home/enlace +touch /home/enlace/enlace.html +cd .. +htpasswd -c passwd admin +cd sites-enabled/ +vi examen.es.conf +cat examen.es.conf +``` + + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + ServerName examen.es + + ServerAdmin webmaster@localhost + DocumentRoot /home/examen.es + DirectoryIndex indice.html + ErrorDocument 403 /error403.html + Alias /enlace/ /home/enlace/enlace.html + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + + + Options FollowSymLinks + AllowOverride None + Require all granted + + + + Options FollowSymLinks + AllowOverride None + Require all granted + +``` +cat ../ports.conf +``` +# If you just change the port or add more ports here, you will likely also +# have to change the VirtualHost statement in +# /etc/apache2/sites-enabled/000-default.conf + +Listen 80 +Listen 8081 + + + Listen 443 + + + + Listen 443 + + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet +```