Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
Doel
Set up Apache on server1 with two name-based websites, one more site on port 82, and test everything from server2.
Voordat je begint
- Work on server1 as root. A repository must be available.
- On server2, add
192.168.122.10 www1.example.com www2.example.comto/etc/hosts.
Taken
Vink een taak aan als hij klaar is. Alleen je browser onthoudt dit.
- Install Apache, make it start at boot, and open HTTP in the firewall.
- Create the site
www1.example.comwith the content "www1" in/srv/www1, andwww2.example.comwith "www2" in/srv/www2. - Make sure SELinux allows Apache to read both folders (permanently).
- Serve the folder
/srv/www2also on port 82 for any name. - From server2, test both names on port 80 and port 82.
Controleer je werk
Hints
Toon de hints
<VirtualHost *:80>withServerNameandDocumentRoot; a<Directory "/srv">block withRequire all granted.semanage fcontext -a -t httpd_sys_content_t "/srv/www[12](/.*)?"+restorecon -Rv /srv.Listen 82+<VirtualHost *:82>; SELinux port typehttp_port_t; firewall port.
Oplossing
Toon de oplossing
- Install and open.
dnf install -y httpd systemctl enable --now httpd firewall-cmd --add-service=http --permanent; firewall-cmd --reload - Content.
- SELinux labels.
semanage fcontext -a -t httpd_sys_content_t "/srv/www[12](/.*)?" restorecon -Rv /srv - The config (tasks 2 and 4) and the port./etc/httpd/conf.d/sites.conf
<Directory "/srv"> Require all granted </Directory> <VirtualHost *:80> ServerName www1.example.com DocumentRoot /srv/www1 </VirtualHost> <VirtualHost *:80> ServerName www2.example.com DocumentRoot /srv/www2 </VirtualHost> Listen 82 <VirtualHost *:82> DocumentRoot /srv/www2 </VirtualHost>semanage port -a -t http_port_t -p tcp 82 firewall-cmd --add-port=82/tcp --permanent; firewall-cmd --reload apachectl configtest && systemctl restart httpd - Test from server2.
Mijn notities
Nog geen notities.