우분투 | Nginx + PHP + DB 세팅법

|

개요

nano 편집기 저장법 ( 컨트롤 + X >> Y >> 엔터 )‌

sudo passwd root [ 비밀번호 입력 ]‌

sudo apt update -y ‌

sudo nano /etc/ssh/sshd_config

[

PermitRootLogin yes

PasswordAuthentication yes 

]‌

sudo timedatectl set-timezone ‘Asia/Seoul’ [시간 설정]‌

date [시간 확인]‌

sudo apt upgrade -y [ 1번 선택 ]‌

sudo apt install nginx -y‌

sudo systemctl start nginx‌

sudo systemctl enable nginx‌

sudo apt install mariadb-server -y‌ [ yes 입력 ]‌

sudo systemctl start mariadb 

sudo systemctl enable mariadb‌ (안됨??)

sudo mysql_secure_installation ( root 비밀번호 입력 후 Lightsail 전부 N EC2 전부 Y )‌

exit: Ctrl+↩

php 8.0 설치

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt install php8.0-fpm
sudo apt install php8.0-apcu php8.0-bz2 php8.0-common php8.0-curl php8.0-gd php8.0-mbstring php8.0-mysql php8.0-xml php8.0-zip php8.0-fpm php8.0-bz2 php8.0-cli php8.0-common php8.0-curl php8.0-gd php8.0-mbstring php8.0-mysql php8.0-opcache php8.0-readline php8.0-xml 
exit: Ctrl+Enter

PHP 일반버전 설치 (7.2)

sudo add-apt-repository ppa:ondrej/php
sudo apt install php7.2-fpm
sudo apt install php7.2-apcu php7.2-bz2 php7.2-common php7.2-curl php7.2-gd php7.2-mbstring php7.2-mysql php7.2-xml php7.2-zip php7.2-fpm php7.2-bz2 php7.2-cli php7.2-common php7.2-curl php7.2-gd php7.2-mbstring php7.2-mysql php7.2-opcache php7.2-readline php7.2-xml 

sudo systemctl restart nginx

sudo nano  /etc/ passwd [ root:x:0:0:root:/var/www/html:/bin/bash ]‌

[ root:x:0:0:root:/home:/bin/bash ]‌

sudo usermod -a -G www-data 아이‌디 nano 편집기 저장법 ( 컨트롤 + X >> Y >> 엔터 )‌

sudo adduser gupsa [ gupsa 계정 생성 ] ‌


sudo usermod -a -G www-data gupsa >>>>>>>>>>>>> gupsa:x:33:33:,,,:/var/www/html:/bin/bash (컨트롤 x 누른 후 y 누름 그리고 엔터)

cd /var/www/html (괜찮다면 ls 한번 해보자)

wget https://ko.wordpress.org/latest-ko_KR.zip

apt install unzip‌

unzip latest-ko_KR.zip‌

sudo mv wordpress/* /home‌

cd /home‌

rm -rf index.html index.nginx-debian.html‌

cd /etc/nginx/sites-enabled/‌

///// 아파치 삭제법

service apache2 stop [아파치 삭제]‌

apt-get remove apache2*‌

apt-get –purge remove apache2*‌

apt-get autoremove‌

apt update‌

apt upgrade [아파치 삭제 완]‌

///// 아파치 삭제법

sudo mysql -u root -p [ 비밀번호 입력 ] ‌

create database 데이터베이스; [ 세미콜론 꼭 입력 ] ‌

create user ‘아이디’@’localhost’ identified by ‘비밀번호’;‌

grant all privileges on 데이터베이스.* to ‘아이디’@’localhost’;‌

[전체권한 grant all privileges on *.* to ‘아이디’@’localhost’; ]

UPDATE mysql.user SET Grant_priv=’Y’, Super_Priv=’Y’ WHERE user=’아이디’;‌

flush privileges;‌

exit;‌

sudo chown -R www-data:www-data /home [폴더 권한 www-data 변경]‌

sudo nano /etc/php/7.4/fpm/php.ini [ PHP 환경설정 수정 ]‌

///ssl 설정하기

sudo apt-get install certbot python3-certbot-nginx [ SSL 설정 직전 ]‌

sudo certbot –nginx -d example.com -d www.example.com‌

sudo certbot renew –dry-run [ 자동 갱신 명령어 ]‌

nano /etc/sudoers [ 아이디 ALL=(ALL:ALL) ALL ] <<< 슈퍼계정 권한부여

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다

클릭하여 복사