Skip to content

Instantly share code, notes, and snippets.

@LukasSchauffele
Last active April 27, 2016 23:32
Show Gist options
  • Save LukasSchauffele/d728c749313651021fd356354804b7ee to your computer and use it in GitHub Desktop.
Save LukasSchauffele/d728c749313651021fd356354804b7ee to your computer and use it in GitHub Desktop.

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

  1. SET IP
  2. DNS Manager
  3. Forward Lookup Zones
  4. New Zone -> www.exam.com -> Non-secure and dynamic
  5. New Host -> Ip address of centos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment