웹서버, DB서버 설치하기
아파치웹서버 설치
#apt -y install apache2 #systemctl restart apache2 #systemctl status apache2 #systemctl enable apache2
아파치를 설치하면 기본적으로 /etc/apache2/ 폴더에 설치되며 apache2.conf파일에 설정값이 존재한다.
서버의 루트 폴더와 각종 설정값이 지정되어 있다.
웹서버 루트폴더
/var/www/html
폴더에 index.html 생성해서 브라우저에서 확인하기
브라우저에 127.0.0.1을 입력한다.
간단한 phpinfo 문서를 만들어서 php 구문이 정상작동하는지 확인한다.
DB서버 설치하기 (mariadb)
mysql과 mariadb중 최근에는 mariadb를 더 많이 사용하는 추세이다.
#apt -y install mariadb-server mariadb-client (서버와 클라이언트 2개를 설치한다.) #systemctl restart mariadb #systemctl status mariadb #systemctl enable mariadb #ufw allow 3306 (방화벽 열기)
#mysql 입력해서 db프로그램이 작동하는지 확인후 exit 빠져나오기
mariadb의 루트 패스워드 입력하기
#mysqladmin -u root -p '패스워드' (db전용 root 패스워드를 지정한다. 간단하게 1234로 지정) #mysql 을 입력하면 로그인이 안됨 #mysql -u root -p (엔터를 입력하면 패스워드를 물어봄)
설정변경
#nano /etc/mysql/mariadb.conf.d/50-server.cnf
내용 중
#bind -address = 127.0.0.1 (주석처리한다.)
한번에 설치하는 명령어가 존재한다.
#apt -y install lamp-server^
mysql 에서 wp_db 를 생성하고 사용자도 생성한다.
#mysql mysql > create database wp_db; mysql > create user wp_user@localhost identified by '1234'; mysql > grant all on wp_db.* to wp_user@localhost;
워드프레스를 다운받고 압축을 푼 후 /var/www/html 폴더에 이동한다.
워드프레스 다운 경로 찾기 (사이트에 접속해서 주소 찾기)
tar 압축 풀기
#tar -zxvf 파일명 #mv 명령어로 폴더 이동하기 #chmod 707 wordpress 권한 풀기 #chown -R www-data.www-data wordpress (소유주를 웹사이트에 접속하는 사람으로 변경)
워드프레스의 db정보 변경
wp-config-sample.php파일을 wp-config.php 복사하고 정보를 입력한다.
초기 경로를 변경하기
#nano /etc/apache2/sites-enables/000-default.conf 열어서 초기 폴더를 지정한다.
ServerAdmin webmaster@localhost 아래줄에 DocumentRoot /var/www/html/wordpress 로 수정
#gedit /etc/apache2/apache2.conf
<Directory /var/www/wordpress>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
내용 수정 , 경로 추가 / 복사해서 붙이기
웹브라우저에서 설치하기, wp-config.php 없이 설치가 가능한 부분 비교하기
오류가 발생할때 업데이트 2번 실행
#apt-get update
#apt-get upgrade
워드프레스 경로
#wget https://ko.wordpress.org/latest-ko_KR.zip #wget https://ko.wordpress.org/wordpress-6.5.3-ko_KR.tar.gz #unzip -q latest-ko_KR.zip #tar -xvfz wordpress-6.5.3-ko_KR.tar.gz