Skip to content

Lab08Apache

echadbourne edited this page Oct 24, 2023 · 12 revisions

Apache default root directory: /var/www/html

As with any new box I started by plugging it into the LAN, turning it on, and changing the root password, as well as making a named wheel account. I then logged out of root and into my named account, did a sudo -i, and opened the nmtui application to start IP configuration.

I set the IP configuration as follows:

  • IP address: 10.0.5.4
  • Gateway: 10.0.5.2
  • DNS Server: 10.0.5.6

I then disabled root ssh in the /etc/ssh/sshd_config file by changing PermitRootLogin from yes to no

I also made a record in the AD server, and checked that everything worked.

Running Apache

I installed httpd with yum install httpd when elevated to root

I configured the firewall with:

  • firewall-cmd --add-service=http --permanent - allows http through the firewall
  • firewall-cmd --add service=https --permanent - allows https through the firewall
  • firewall-cmd --reload - reloads the firewall so the changes take effect

Then I started the service: systemctl start httpd

To test that this was working I connected to http://web01-elizabeth/ and I got the test page.

New HTML page

I removed the welcome page from /etc/httpd/conf.d/welcome.conf

And made my own welcome message that said "Welcome to Beth's Web Server!! (please work)" and it did! This is what the index.html file looked like:

<!DOCTYPE html>

<html>

<body>

Welcome to Beth's Web Server!

</body>

</html>

PHP

Next I had to install php with yum install -y php while elevated to root privileges

Then I made a simple php site, however as of right now I cannot get it to work. I keep getting a 403 Forbidden error, and its only with the php file.

Configuration filepath for the apache server: /etc/httpd/conf/httpd.conf

Solution

I made a new file named file.php and this seemed to work, so I'm guessing there was some sort of issue with the file being named index.php, because the both have the same content but one works and one doesn't.

Joining to the Domain

I had to install realmd:

  • sudo yum install -y realmd samba samba-common oddjob oddjob-mkhomedir sssd

Then join the server to the domain:

  • realm join --user=echadbourne-adm@elizabeth.local elizabeth.local
  • Enter my domain admin password
  • Viola!

And listed the domain information for the device:

  • realm list

And I was able to successfully log in as a domain user

Clone this wiki locally