Virtual Hosting - ConnorEast/Tech-Journal GitHub Wiki
Step 1: Open your LWS1 Sever;
Step 2: Confirm your LWS1 Server has a IP using "ip addr" or "ifconfig";
Step 3: Install Apache Web Services / PHP and allow it through the firewall:
Command 1: "yum install -y httpd";
Command 2: "firewall-cmd --permanent --add-port=80/tcp";
Command 3: "firewall-cmd --permanent --add-port=443/tcp";
Command 4: "firewall-cmd --reload";
Command 5: "systemctl start httpd";
Step 4: Go to http://10.0.5.6 on your WRK1 or AD01 server; Step 5: If the website opens without errors move to the next section:
Command 1: yum install -y php php-mysql
Command 2: systemctl restart httpd
Major Note: Names will have to be more complex then simply our first names. This is because connor.com is already a taken address.
Step 1: Go to the directory "/var/www" and create a directory called "vhosts"
Step 2: For each individual create a directory of "/var/www/vhosts/(Connor, Benjamine, Kerry).com/html" inside the directory create a "index.php" file.
Step 3: Go to "/etc/httpd/conf.d" and create a file labeled "(Connor, Benjamine, Kerry).com.conf" add the following information to each.
<VirtualHost *:80>
DocumentRoot "/var/www/vhosts/(Connor, Benjamine, Kerry).com/html"
ServerName (Connor, Benjamine, Kerry).com
ServerAlias www.(Connor, Benjamine, Kerry).com
<Directory /var/www/vhosts/(Connor, Benjamine, Kerry)/html>
AllowOverride All
Options Indexes FollowSymLinks
Require all granted
Step 4: Restart httpd.
Step 1: Edit the file located at:
- Windows --->"C:\Windows\System32\Drivers\etc\Hosts"
- Kali ---> "/etc/hosts"
With the information below:
10.0.5.6 connor.com
10.0.5.6 Benjamine.com
10.0.5.6 Kerry.com
Step 2: Save the file, restart your machine, and attempt to use the URL.
Command 1: yum -y install mariadb-server
Command 2: systemctl start mariadb
Command 3: systemctl enable mariadb.service
Command 4: mysql_secure_installation
Once installation has completed, use the command "mysql -u root -p". This allows you to log into MySQL as user root.
Command 5: "CREATE DATABASE [database-Name]"
Command 6: GRANT ALL ON [database-Name] .* TO '[insert-User]'@'localhost' IDENTIFIED BY '[insert-Password]' WITH GRANT OPTIONS
Command 7: FLUSH PRIVILEGES