[root@localhost apache2]# vi /etc/sysconfig/iptables
// 빈 파일이 나옴 이름이 변경됨
[root@localhost sysconfig]# vi /etc/sysconfig/iptables-config
2020.04.17일 기준 [출처] : https://aeac.tistory.com/20
■ [APM] Apache, PHP, MariaDB Install(설치) Guide
1. 의존성 라이브러리 설치
□ 아래는 라이브러리가 설치되어있는지 확인해보는 부분이며 APM에 꼭 필요한 패키지가 있습니다.
BASH
[root@localhost apache2]# rpm -qa libjpeg* libpng* freetype* gd-* gcc gcc-c++ gdbm-devel libtermcap-devel
freetype-2.8-14.el7.x86_64
libjpeg-turbo-1.2.90-8.el7.x86_64
gcc-4.8.5-39.el7.x86_64
gcc-c++-4.8.5-39.el7.x86_64
libpng-1.5.13-7.el7_2.x86_64
□ Yum 으로 아래의 필요한 라이브러리를 한번에 전부 설치합니다. (한번에 관련된 의존성도 같이 설치가 됩니다.)
[root@localhost apache2]# yum install libjpeg* libpng* freetype* gd-* gcc gcc-c++ gdbm-devel libtermcap-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.kakao.com
* extras: mirror.kakao.com
* updates: mirror.kakao.com
...
Dependencies Resolved
=====================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================
Installing:
freetype-demos x86_64 2.8-14.el7 base 188 k
freetype-devel x86_64 2.8-14.el7 base 447 k
gd x86_64 2.0.35-26.el7 base 146 k
gd-devel x86_64 2.0.35-26.el7 base 79 k
gd-progs x86_64 2.0.35-26.el7 base 36 k
gdbm-devel x86_64 1.10-8.el7 base 47 k
libjpeg-turbo-devel x86_64 1.2.90-8.el7 base 99 k
libjpeg-turbo-static x86_64 1.2.90-8.el7 base 120 k
libjpeg-turbo-utils x86_64 1.2.90-8.el7 base 77 k
libpng-devel x86_64 2:1.5.13-7.el7_2 base 122 k
libpng-static x86_64 2:1.5.13-7.el7_2 base 92 k
libpng12 x86_64 1.2.50-10.el7 base 171 k
libpng12-devel x86_64 1.2.50-10.el7 base 111 k
ncurses-devel x86_64 5.9-14.20130511.el7_4 base 712 k
Installing for dependencies:
expat-devel x86_64 2.1.0-10.el7_3 base 57 k
fontconfig-devel x86_64 2.13.0-4.3.el7 base 138 k
libX11-devel x86_64 1.6.7-2.el7 base 981 k
libXau-devel x86_64 1.0.8-2.1.el7 base 14 k
libXpm x86_64 3.5.12-1.el7 base 55 k
libXpm-devel x86_64 3.5.12-1.el7 base 36 k
libXt x86_64 1.1.5-3.el7 base 173 k
libuuid-devel x86_64 2.23.2-61.el7_7.1 updates 92 k
libxcb-devel x86_64 1.13-1.el7 base 1.1 M
perl x86_64 4:5.16.3-294.el7_6 base 8.0 M
perl-Carp noarch 1.26-244.el7 base 19 k
perl-Encode x86_64 2.51-7.el7 base 1.5 M
perl-Exporter noarch 5.68-3.el7 base 28 k
perl-File-Path noarch 2.09-2.el7 base 26 k
perl-File-Temp noarch 0.23.01-3.el7 base 56 k
perl-Filter x86_64 1.49-3.el7 base 76 k
perl-Getopt-Long noarch 2.40-3.el7 base 56 k
perl-HTTP-Tiny noarch 0.033-3.el7 base 38 k
perl-PathTools x86_64 3.40-5.el7 base 82 k
perl-Pod-Escapes noarch 1:1.04-294.el7_6 base 51 k
perl-Pod-Perldoc noarch 3.20-4.el7 base 87 k
perl-Pod-Simple noarch 1:3.28-4.el7 base 216 k
perl-Pod-Usage noarch 1.63-3.el7 base 27 k
perl-Scalar-List-Utils x86_64 1.27-248.el7 base 36 k
perl-Socket x86_64 2.010-4.el7 base 49 k
perl-Storable x86_64 2.45-3.el7 base 77 k
perl-Text-ParseWords noarch 3.29-4.el7 base 14 k
perl-Time-HiRes x86_64 4:1.9725-3.el7 base 45 k
perl-Time-Local noarch 1.2300-2.el7 base 24 k
perl-constant noarch 1.27-2.el7 base 19 k
perl-libs x86_64 4:5.16.3-294.el7_6 base 688 k
perl-macros x86_64 4:5.16.3-294.el7_6 base 44 k
perl-parent noarch 1:0.225-244.el7 base 12 k
perl-podlators noarch 2.5.1-3.el7 base 112 k
perl-threads x86_64 1.87-4.el7 base 49 k
perl-threads-shared x86_64 1.43-6.el7 base 39 k
xorg-x11-proto-devel noarch 2018.4-1.el7 base 280 k
zlib-devel x86_64 1.2.7-18.el7 base 50 k
Transaction Summary
=====================================================================================================================
Install 14 Packages (+38 Dependent packages)
Total download size: 17 M
Installed size: 52 M
Is this ok [y/d/N]: y
...
Installed:
freetype-demos.x86_64 0:2.8-14.el7 freetype-devel.x86_64 0:2.8-14.el7
gd.x86_64 0:2.0.35-26.el7 gd-devel.x86_64 0:2.0.35-26.el7
gd-progs.x86_64 0:2.0.35-26.el7 gdbm-devel.x86_64 0:1.10-8.el7
libjpeg-turbo-devel.x86_64 0:1.2.90-8.el7 libjpeg-turbo-static.x86_64 0:1.2.90-8.el7
libjpeg-turbo-utils.x86_64 0:1.2.90-8.el7 libpng-devel.x86_64 2:1.5.13-7.el7_2
libpng-static.x86_64 2:1.5.13-7.el7_2 libpng12.x86_64 0:1.2.50-10.el7
libpng12-devel.x86_64 0:1.2.50-10.el7 ncurses-devel.x86_64 0:5.9-14.20130511.el7_4
Dependency Installed:
expat-devel.x86_64 0:2.1.0-10.el7_3 fontconfig-devel.x86_64 0:2.13.0-4.3.el7
libX11-devel.x86_64 0:1.6.7-2.el7 libXau-devel.x86_64 0:1.0.8-2.1.el7
libXpm.x86_64 0:3.5.12-1.el7 libXpm-devel.x86_64 0:3.5.12-1.el7
libXt.x86_64 0:1.1.5-3.el7 libuuid-devel.x86_64 0:2.23.2-61.el7_7.1
libxcb-devel.x86_64 0:1.13-1.el7 perl.x86_64 4:5.16.3-294.el7_6
perl-Carp.noarch 0:1.26-244.el7 perl-Encode.x86_64 0:2.51-7.el7
perl-Exporter.noarch 0:5.68-3.el7 perl-File-Path.noarch 0:2.09-2.el7
perl-File-Temp.noarch 0:0.23.01-3.el7 perl-Filter.x86_64 0:1.49-3.el7
perl-Getopt-Long.noarch 0:2.40-3.el7 perl-HTTP-Tiny.noarch 0:0.033-3.el7
perl-PathTools.x86_64 0:3.40-5.el7 perl-Pod-Escapes.noarch 1:1.04-294.el7_6
perl-Pod-Perldoc.noarch 0:3.20-4.el7 perl-Pod-Simple.noarch 1:3.28-4.el7
perl-Pod-Usage.noarch 0:1.63-3.el7 perl-Scalar-List-Utils.x86_64 0:1.27-248.el7
perl-Socket.x86_64 0:2.010-4.el7 perl-Storable.x86_64 0:2.45-3.el7
perl-Text-ParseWords.noarch 0:3.29-4.el7 perl-Time-HiRes.x86_64 4:1.9725-3.el7
perl-Time-Local.noarch 0:1.2300-2.el7 perl-constant.noarch 0:1.27-2.el7
perl-libs.x86_64 4:5.16.3-294.el7_6 perl-macros.x86_64 4:5.16.3-294.el7_6
perl-parent.noarch 1:0.225-244.el7 perl-podlators.noarch 0:2.5.1-3.el7
perl-threads.x86_64 0:1.87-4.el7 perl-threads-shared.x86_64 0:1.43-6.el7
xorg-x11-proto-devel.noarch 0:2018.4-1.el7 zlib-devel.x86_64 0:1.2.7-18.el7
Complete!
2. [APM] Apache, PHP, MariaDB 설치 [순서는 : Apache, Maria, PHP 진행]
□ 아파치(Apache) 설치
[root@localhost apache2]# yum install httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.kakao.com
* extras: mirror.kakao.com
* updates: mirror.kakao.com
...
Dependencies Resolved
=====================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================
Installing:
httpd x86_64 2.4.6-90.el7.centos base 2.7 M
Installing for dependencies:
apr x86_64 1.4.8-5.el7 base 103 k
apr-util x86_64 1.5.2-6.el7 base 92 k
httpd-tools x86_64 2.4.6-90.el7.centos base 91 k
mailcap noarch 2.1.41-2.el7 base 31 k
Transaction Summary
=====================================================================================================================
Install 1 Package (+4 Dependent packages)
Total download size: 3.0 M
Installed size: 10 M
Is this ok [y/d/N]: y
...
Installed:
httpd.x86_64 0:2.4.6-90.el7.centos
Dependency Installed:
apr.x86_64 0:1.4.8-5.el7 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-90.el7.centos
mailcap.noarch 0:2.1.41-2.el7
Complete!
□ 마리아(Maria DB) 설치
[root@localhost apache2]# yum install mariadb mariadb-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.kakao.com
* extras: mirror.kakao.com
* updates: mirror.kakao.com
...
Dependencies Resolved
=====================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================
Installing:
mariadb x86_64 1:5.5.64-1.el7 base 8.7 M
mariadb-server x86_64 1:5.5.64-1.el7 base 11 M
Installing for dependencies:
perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7 base 32 k
perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 base 57 k
perl-DBD-MySQL x86_64 4.023-6.el7 base 140 k
perl-DBI x86_64 1.627-4.el7 base 802 k
perl-Data-Dumper x86_64 2.145-3.el7 base 47 k
perl-IO-Compress noarch 2.061-2.el7 base 260 k
perl-Net-Daemon noarch 0.48-5.el7 base 51 k
perl-PlRPC noarch 0.2020-14.el7 base 36 k
Transaction Summary
=====================================================================================================================
Install 2 Packages (+8 Dependent packages)
Total download size: 21 M
Installed size: 110 M
Is this ok [y/d/N]: y
...
Installed:
mariadb.x86_64 1:5.5.64-1.el7 mariadb-server.x86_64 1:5.5.64-1.el7
Dependency Installed:
perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7
perl-DBD-MySQL.x86_64 0:4.023-6.el7 perl-DBI.x86_64 0:1.627-4.el7
perl-Data-Dumper.x86_64 0:2.145-3.el7 perl-IO-Compress.noarch 0:2.061-2.el7
perl-Net-Daemon.noarch 0:0.48-5.el7 perl-PlRPC.noarch 0:0.2020-14.el7
Complete!
□ PHP 설치
[root@localhost apache2]# yum install php php-mysql php-mbstring php-pdo php-gd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.kakao.com
* extras: mirror.kakao.com
* updates: mirror.kakao.com
...
=====================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================
Installing:
php x86_64 5.4.16-46.1.el7_7 updates 1.4 M
php-gd x86_64 5.4.16-46.1.el7_7 updates 128 k
php-mbstring x86_64 5.4.16-46.1.el7_7 updates 505 k
php-mysql x86_64 5.4.16-46.1.el7_7 updates 101 k
php-pdo x86_64 5.4.16-46.1.el7_7 updates 99 k
Installing for dependencies:
libzip x86_64 0.10.1-8.el7 base 48 k
php-cli x86_64 5.4.16-46.1.el7_7 updates 2.7 M
php-common x86_64 5.4.16-46.1.el7_7 updates 565 k
t1lib x86_64 5.1.2-14.el7 base 166 k
Transaction Summary
=====================================================================================================================
Install 5 Packages (+4 Dependent packages)
Total download size: 5.7 M
Installed size: 19 M
Is this ok [y/d/N]: y
...
Installed:
php.x86_64 0:5.4.16-46.1.el7_7 php-gd.x86_64 0:5.4.16-46.1.el7_7 php-mbstring.x86_64 0:5.4.16-46.1.el7_7
php-mysql.x86_64 0:5.4.16-46.1.el7_7 php-pdo.x86_64 0:5.4.16-46.1.el7_7
Dependency Installed:
libzip.x86_64 0:0.10.1-8.el7 php-cli.x86_64 0:5.4.16-46.1.el7_7 php-common.x86_64 0:5.4.16-46.1.el7_7
t1lib.x86_64 0:5.1.2-14.el7
Complete!
□ 설치 확인 및 버전확인
[root@localhost apache2]# rpm -qa httpd mariadb php
httpd-2.4.6-90.el7.centos.x86_64
mariadb-5.5.64-1.el7.x86_64
php-5.4.16-46.1.el7_7.x86_64
■ [APM] Apache, PHP, MariaDB config(설정) 및 구동
1. 아파치(Apache) 설정 및 구동
□ 기본설정
[root@localhost apache2]# vi /etc/httpd/conf/httpd.conf
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User nobody //>>>수정됨
Group nobody //>>>수정됨
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName 192.168.0.31:80 //>>>수정됨
/* 저장후 종료방법
ESC를 치면 삽입 또는 삭제모드에서 빠져나옴
Shift + 세미콜론(;)을 치면 하단에 콜론 라인이 생김
WQ : 저장후 종료
Q! : 저장하지 않고 종료 */
[참고] ■ apache → nobody 변경 ROOT 권한으로 실행된 아파치의 하위 프로세스를 이곳에서 지정한 사용자로 실행한다는 의미, 기본값으로 apache 또는 daemon 으로 되어있지만 대부분 nobody로 변경하여 이용한다. 약간 보안적인 의미를 포함
■ ServerName 자기 서버가 이 도메인을 사용한다는것을 알리기 위한 수단, 예를 들어 ServerName www.test.com:80 → 홈페이지 접속시 해당 도메인(http://www.test.com)으로 연결 ServerName 192.168.122.128:80 → 홈페이지 접속시 해당 도메인((http://192.168.122.128)으로 연결 (도메인이 없을경우 IP 입력)
■ IP는 자기서버 IP 셋팅 [root@localhost ~]# ifconfig ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.223.129 (이부분) netmask 255.255.255.0 broadcast 192.168.223.255 |
□ 방화벽 설정
환경설정이 완료가 되었으니 웹을 열기위해선 방화벽 80번 포트를 오픈해야합니다. 하지만 iptables 파일이 없으므로 아래와 같이 기본방화벽프로그램을 설치합니다.
CentOS 6버전까지는 기본 방화벽을 iptables로 사용했지만, CentOS 7버전에서는 기본 방화벽을 firewalld로 사용합니다. iptables를 위해 firewalld 서비스를 중지해주실 필요가 있습니다. 따라서 아래의 명령어로 firewalld를 비활성화합니다. 출처: https://sata.kr/entry/IPTables-1공짜방화벽-IPTables-설치하기-CentOS-67 [SATAz BLOG] |
#firewalld 비활성화 명령어
[root@localhost /]# systemctl stop firewalld
[root@localhost sysconfig]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Fri 2020-04-17 16:29:20 KST; 35s ago
Docs: man:firewalld(1)
Process: 23642 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
Main PID: 23642 (code=exited, status=0/SUCCESS)
Apr 17 03:08:45 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
Apr 17 03:08:45 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
Apr 17 16:29:20 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
Apr 17 16:29:20 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.
yum 패키지 매니저를 통해서 iptables 서비스를 설치합니다. |
BASH
[root@localhost sysconfig]# yum install iptables-services
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.kakao.com
* extras: mirror.kakao.com
* updates: mirror.kakao.com
...
=====================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================
Installing:
iptables-services x86_64 1.4.21-33.el7 base 52 k
Transaction Summary
=====================================================================================================================
Install 1 Package
Total download size: 52 k
Installed size: 22 k
Is this ok [y/d/N]: y
...
Installed:
iptables-services.x86_64 0:1.4.21-33.el7
Complete!
설치가 완료가 되었으니 웹을 열기위해선 방화벽 80번 포트를 오픈합니다.
[root@localhost sysconfig]# vi /etc/sysconfig/iptables
# sample configuration for iptables service
# you can edit this manually or use system-config-firewall
# please do not ask us to add additional ports/services to this default configuration
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT //추가함
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
[참고] ■ iptables 에서 순서는 매우 중요합니다. 일반적으로 적용되는 순서는 위에서부터 아래로 순차적으로 읽어옵니다. 예를들어 추가한 맨 아래의 라인쪽에 추가를 하게되면 적용이 정상적으로 안됩니다. |
□ 방화벽 재시작
[root@localhost sysconfig]# service iptables restart
Redirecting to /bin/systemctl restart iptables.service
[root@localhost sysconfig]#
□ 적용 확인
[root@localhost sysconfig]# iptables -nL
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:80
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
target prot opt source destination
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
[root@localhost sysconfig]#
□ 아파치 시작
BASH
[root@localhost sysconfig]# systemctl start httpd
[root@localhost sysconfig]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
□ 부팅후 자동 실행 설정
[root@localhost ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
□ 부팅후 자동 실행 설정(해제)
[root@localhost ~]# systemctl disable httpd
Removed symlink /etc/systemd/system/multi-user.target.wants/httpd.service.
□ Service 명령어 이용 가능
[root@localhost ~]# service httpd start(stop)
□ 아파치 구동 확인
[root@localhost sysconfig]# ps -ef |grep httpd
root 25870 1 0 17:05 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
nobody 25872 25870 0 17:05 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
nobody 25873 25870 0 17:05 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
nobody 25874 25870 0 17:05 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
nobody 25875 25870 0 17:05 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
nobody 25876 25870 0 17:05 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
root 25896 10170 0 17:07 pts/0 00:00:00 grep --color=auto httpd
[root@localhost sysconfig]#
□ 실제 웹 구동 확인 완료
2. PHP 환경설정 및 구동(경로)
□ 기본설정
[root@localhost]# vi /etc/httpd/conf/httpd.conf
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php // index.php 추가함
</IfModule>
...
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig /etc/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
AddType application/x-httpd-php .php .html .htm .inc //추가함
AddType application/x-httpd-php-source .phps //추가함
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
[참고] ■ 실제 PHP환경설정을 관리하는 파일은 아래의 경로입니다. [root@localhost ~]# vi /etc/php.ini
위 httpd.conf 쪽에 셋팅하는건 아파치에 php 관련 처리를 할수 있게 추가를 하는 부분입니다. |
□ PHP 적용
Yum 설치시 html 업로드 기본 디렉토리는 아래와 같습니다.
BASH
[root@localhost ~]# cd /var/www/html/
해당 경로에서 PHP의 정보를 보여주는 함수의 파일을 하나 생성합니다.
[root@localhost sysconfig]# vi /var/www/html/phpinfo.php
<?php phpinfo(); ?>
[root@localhost sysconfig]# cd /var/www/html/
[root@localhost html]# ll
total 4
-rw-r--r--. 1 root root 20 Apr 17 17:22 phpinfo.php
[root@localhost html]# cat phpinfo.php
<?php phpinfo(); ?>
[root@localhost html]#
BASH
PHP 환경설정을 적용하기위해 아파치(Apache)도 한번 재시작을 합니다.
[root@localhost html]# service httpd restart
Redirecting to /bin/systemctl restart httpd.service
[root@localhost html]#
BASH
항상 아파치(Apache) 구동이 제대로 되고 있는지 확인합니다.
[root@localhost html]# ps -ef | grep httpd
root 25950 1 0 17:25 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
nobody 25952 25950 0 17:25 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
nobody 25953 25950 0 17:25 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
nobody 25954 25950 0 17:25 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
nobody 25955 25950 0 17:25 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
nobody 25956 25950 0 17:25 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
root 25958 10170 0 17:26 pts/0 00:00:00 grep --color=auto httpd
[root@localhost html]#
BASH
□ PHP 적용 확인 테스트
개인 PC에서 인터넷창에 접속 테스트를 진행하면 됩니다.
이전 경로에 생성하였던 경로를 입렵합니다. URL : http://192.168.223.129/phpinfo.php
3. Maria DB 구동 및 설정
□ Maria DB 구동 및 구동 확인
[root@localhost html]# systemctl start mariadb
[root@localhost html]# ps -ef | grep maria
mysql 26217 26055 0 17:30 ? 00:00:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socket=/var/lib/mysql/mysql.sock
root 26253 10170 0 17:30 pts/0 00:00:00 grep --color=auto maria
[root@localhost html]#
□ Maria DB 기본설정 (DB가 구동된 상태에서 진행가능)
[root@localhost html]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Enter current password for root (enter for none): //패스워드가 없기때문에 엔터
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y //(DB ROOT 패스워드 설정)
New password: //패스워드입력
Re-enter new password: //재확인 패스워드입력
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y //(익명의 접근을 막을것인지? 보안을 위해 Y 엔터)
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y //(DB ROOT 원격을 막을것인지? 보안을 위해 Y 엔터)
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y //(Test 용으로 생성된 데이터베이스를 삭제할것인가? Y 엔터)
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
[root@localhost html]#
□ Maria DB 최종 접속 확인
[root@localhost html]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 15
Server version: 5.5.64-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.
MariaDB [(none)]> quit
Bye
[root@localhost html]#
[참고] Maria(Mysql) 환경설정을 관리하는 파일은 아래의 경로입니다. [root@localhost ~]# vi /etc/my.cnf |