Set firewall
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
Start apache and mysql
systemctl enable mariadb.service httpd.service
systemctl start mariadb.service httpd.service
Database stuff
Create database:
mysql_secure_installation
mysql -u root -ptoor
MariaDB > create database DB; exit;
Edit phpMyAdmin config /etc/httpd/conf.d/phpMyAdmin.conf
Require all granted
# Order Deny,Allow
# Deny from All
AllowOverride None
Options None
Allow from All
Require all granted
Restore database
# mysql -u root -ptoor DB < /home/student/Downloads/file.sql
Dump specific tables:
# mysqldump -u root -ptoor DB table1 table2 > /home/student/Desktop/backup.sql
Apache stuff
Create website folder
mkdir -p /var/www/exam.com/public_html
nano /var/www/exam.com/public_html/index.html
touch /var/www/exam.com/error.log /var/www/exam.com/requests.log
Config files
Append to: /etc/httpd/conf/httpd.conf
NameVirtualHost *:8`
IncludeOptional sites-enabled/*.conf
mkdir /etc/httpd/sites-available /etc/httpd/sites-enabled
nano /etc/httpd/sites-available/exam.com.conf
<VirtualHost localhost:80>
DocumentRoot /var/www/html
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/exam.com/public_html
ServerName www.exam.com
ServerAlias exam.com
ErrorLog /var/www/exam.com/error.log
CustomLog /var/www/exam.com/requests.log combined
</VirtualHost>
Link logs and new domain
chcon --reference /var/log/httpd/error.log /var/www/exam.com/error.log
chcon --reference /var/log/httpd/access.log /var/www/exam.com/requests.log
ls -s /etc/httpd/sites-available/exam.com.conf /etc/httpd/sites-enabled/
Restart server
systemctl restart httpd.service
apachectl configtest
Windows DNS
- SET IP
- DNS Manager
- Forward Lookup Zones
- New Zone -> www.exam.com -> Non-secure and dynamic
- New Host -> Ip address of centos