>> mrt 2018: -3- apache2
apache op centos
- installeren van apache2
[student@cOS74-T06-2 etc]$ sudo yum install httpd Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp.belnet.be * extras: ftp.belnet.be * updates: ftp.belnet.be Resolving Dependencies --> Running transaction check ---> Package httpd.x86_64 0:2.4.6-67.el7.centos.6 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================= Package Arch Version Repository Size ================================================================================= Installing: httpd x86_64 2.4.6-67.el7.centos.6 updates 2.7 M Transaction Summary ================================================================================= Install 1 Package Total download size: 2.7 M Installed size: 9.4 M Is this ok [y/d/N]: t Is this ok [y/d/N]: y Downloading packages: httpd-2.4.6-67.el7.centos.6.x86_64.rpm | 2.7 MB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : httpd-2.4.6-67.el7.centos.6.x86_64 1/1 Verifying : httpd-2.4.6-67.el7.centos.6.x86_64 1/1 Installed: httpd.x86_64 0:2.4.6-67.el7.centos.6 Complete!
- installeren van lynx
we hebben lynx browser nodig om te testen vanaf CLI ...[student@cOS74-T06-2 etc]$ sudo yum install lynx Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp.belnet.be * extras: ftp.belnet.be * updates: ftp.belnet.be Resolving Dependencies --> Running transaction check ---> Package lynx.x86_64 0:2.8.8-0.3.dev15.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================= Package Arch Version Repository Size ================================================================================= Installing: lynx x86_64 2.8.8-0.3.dev15.el7 base 1.4 M Transaction Summary ================================================================================= Install 1 Package Total download size: 1.4 M Installed size: 5.4 M Is this ok [y/d/N]: y Downloading packages: lynx-2.8.8-0.3.dev15.el7.x86_64.rpm | 1.4 MB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : lynx-2.8.8-0.3.dev15.el7.x86_64 1/1 Verifying : lynx-2.8.8-0.3.dev15.el7.x86_64 1/1 Installed: lynx.x86_64 0:2.8.8-0.3.dev15.el7 Complete!
- apache testen
$ lynx localhost
ALERT- unable to connect to remote hosts
we moeten apache2 enablen:[student@cOS74-T06-2 etc]$ sudo systemctl enable httpd Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service. [student@cOS74-T06-2 etc]$ sudo systemctl start httpd
$ lynx localhost
Testing 123..This page is used to test the proper operation of the Apache HTTP server after it has been installed. If you can read this page it means that this site is working properly. This server is powered by CentOS.
The website you just visited is either experiencing problems or is undergoing routine maintenance.
Are you the Administrator? You should add your website content to the directory /var/www/html/. To prevent this page from ever being used, follow the instructions in the file /etc/httpd/conf.d/welcome.conf.
we zetten een index.html in /var/www/html
GNU nano 2.3.1 File: index.html Modified <html> <body> <h1>default webpage from st06 on centos 16 mar 2018</h1> </body> </html>
testen opnieuw ...
$ lynx localhost
default webpage from st06 on centos 16 mar 2018
bingo -- twerkt
- centOS firewall -- apache2 toegankelijk maken van buitenaf
Het werkt wel maar nog niet helemaal ....
Op firefox onder Mint18 krijgen we: unable to connect
centOS7 firewall
We bekijken eerst alle firewall zondes:[student@cOS74-T06-2 html]$ sudo firewall-cmd --list-all-zones block target: %%REJECT%% icmp-block-inversion: no interfaces: sources: services: ports: protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules: dmz target: default icmp-block-inversion: no interfaces: sources: services: ssh ports: protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules: drop target: DROP icmp-block-inversion: no interfaces: sources: services: ports: protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules: external target: default icmp-block-inversion: no interfaces: sources: services: ssh ports: protocols: masquerade: yes forward-ports: source-ports: icmp-blocks: rich rules: home target: default icmp-block-inversion: no interfaces: sources: services: ssh mdns samba-client dhcpv6-client ports: protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules: internal target: default icmp-block-inversion: no interfaces: sources: services: ssh mdns samba-client dhcpv6-client ports: protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules: public (active) target: default icmp-block-inversion: no interfaces: ens192 sources: services: ssh dhcpv6-client ports: protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules: trusted target: ACCEPT icmp-block-inversion: no interfaces: sources: services: ports: protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules: work target: default icmp-block-inversion: no interfaces: sources: services: ssh dhcpv6-client ports: protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules:
In de public zone is er geen httpd ...
dat moeten we aanpassen:[student@cOS74-T06-2 html]$ sudo firewall-cmd --zone=public --add-service=http --permanent success [student@cOS74-T06-2 html]$ sudo firewall-cmd --reload success
nu werkt apache, ook van buitenaf ...