# DB์ web ๋ถ๋ฆฌ ๊ตฌ์ถ
# ์๋ฒ ๊ตฌ์ถ
CentOS7 First vmware
# ๋ธ๋ฆฟ์ง ์ค์
centos newwork Adapter - nat์์ bridged๋ก ๋ณ๊ฒฝ
vim /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPROTO="static"
IPADDR=192.168.0.41
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
DNS1=8.8.8.8
systemctl restart network
# httpd, php, mariadb, mariadb-server, php-mysqlnd ์ค์น
yum -y install httpd php mariadb mariadb-server php-mysqlnd
systemctl restart httpd
systemctl restart mariadb
systemctl status httpd
systemctl status mariadb
systemctl enable httpd
systemctl enable mariadb
# ๋ฐฉํ๋ฒฝ
systemctl stop firewalld
systemctl diable firewalld
setenforce 0
# XE ์๋ฒ ๊ตฌ์ถ
cd /home/centos/๋ค์ด๋ก๋
mv xe.zip /var/www/html
cd /var/www/html
unzip xe.zip
yum -y install php-*
yum -y --skip-broken install php-*
vim /etc/httpd/conf/httpd.conf
>> :set nu
>> 151
>> AllowOverride All
systemctl restart httpd
chmod 707 xe
cd xe
systemctl restart httpd
# DDOS ๊ณต๊ฒฉ ๋ฐฉ์ดํ๊ธฐ ๋ช
๋ น์ด
iptables -I INPUT -p tcp --dport 80 -m state --state NEW -m recent --update --seconds 1 --hitcount 10 -j DROP
# DB ๊ตฌ์ถ
Centos7 Second vmware
# ๋ธ๋ฆฟ์ง ์ค์
centos newwork Adapter - nat์์ bridged๋ก ๋ณ๊ฒฝ
vim /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPROTO="static"
IPADDR=192.168.0.42
NETMASK=255.255.255.0
GATEWAY=192.168.0.2
DNS1=8.8.8.8
systemctl restart network
# ๋ฐฉํ๋ฒฝ ํด์
systemctl stop firewalld
systemctl diable firewalld
setenforce 0
# DB์ค์น
yum -y install mariadb mariadb-server
yum -y --skip-broken install php php-*
systemctl restart mariadb
systemctl enable mariadb
# mariadb database ์ค๋ฅ
mysql
GRANT ALL PRIVILEGES ON wpDB.* TO wpUser@'%' IDENTIFIED BY '1234';
# wpDB์ ์ ๊ทผํด์ ์ฌ์ฉํ๋ ๋ชจ๋ ๋ช
๋ น์ด์ ๊ถํ์
# ์ด๋์ ์ ์ํ๋ wpUser์๊ฒ ์ฌ์ฉ๊ฐ๋ฅํ๊ฒ ํจ
GRANT ALL PRIVILEGES ON wpDB.* TO wpUser@localhost IDENTIFIED BY '1234';
# wpDB์ ์ ๊ทผํด์ ์ฌ์ฉํ๋ ๋ชจ๋ ๋ช
๋ น์ด์ ๊ถํ์
# ๋ก์ปฌ์์ ์ ์ํ ๋ wpUser์๊ฒ ์ฌ์ฉ๊ฐ๋ฅํ๊ฒ ํจ
EXIT
mysql -u wpUser -p1234
CREATE DATABASE wpDB; #wpDB๋ฐ์ดํฐ ๋ฒ ์ด์ค ์์ฑ ๊ฐ๋ฅ
# mariadb database ์ธ๋ถ ์ ์ ํ์ฉ
mysql -u root -p
use mysql; #database๋ฅผ mysql๋ก ๋ณ๊ฒฝ
select host,user from user;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '1234';
# *.*์ ๋ชจ๋ DB์ ๊ทผ, '%' ๋ชจ๋ IP์ ๋ํด ํ์ฉ
flush privileges; # grant all ๋ช
๋ น์ด ์ ์ฉ
# ๋ฐฉํ๋ฒฝ ์ค์
systemctl restart firewalld
firewall-cmd --zone=public --permanent --add-port=3306/tcp
# CentOS์์ ๊ธฐ๋ณธ์ ์ผ๋ก 3306port๊ฐ ๋ฐฉํ๋ฒฝ์์ ์ฐจ๋จ๋์ด์๊ธฐ์ ์ฐจ๋จ ํด์
firewall-cmd --reload #๋ฐฉํ๋ฒฝ ์ฌ๋ก๋ฉ
# ์๋ฒ์ ๋ฐ์ดํฐ ๋ฒ ์ด์ค ์ฐ๋ ํ์ธ
mysql -h 192.168.0.42 -u webUser -p1234;
# webUser ๋ฐ์ดํฐ ๋ฒ ์ด์ค๋ฅผ ๊ตฌ์ถํ centos second ip์ฃผ์ ์
๋ ฅ ,
# ๋ฐ์ดํฐ๋ฒ ์ด์ค ๊ณ์ ๋น๋ฐ๋ฒํธ ์
๋ ฅ
Welcome to the MariaDB monitor. Commands end with ; or \\g.
Your MariaDB connection id is 13
Server version: 5.5.68-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.
# ์ ์ ์๋ฃ ํ์ธ
# ๋ฐ์ดํฐ ๋ฒ ์ด์ค ํ์ธ
SHOW DATABASES;
# webDB ๋ฐ์ดํฐ ๋ฒ ์ด์ค ํ์ธ