sudo apt update
패키지 저장소
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt-get install php7.4 php7.4-cli php7.4-fpm php7.4-mysql php7.4-gd php7.4-curl php-common php7.4-mbstring php7.4-zip php7.4-xml php7.4-xmlrpc php7.4-opcache
패키지 삭제
sudo apt-get --purge remove
패키지 검색
sudo apt-cache search
패키지 정보 보기
sudo apt-cache show
설치된 패키지 조회
apt --installed list *php*
vi /etc/php/7.4/apache2/php.ini
short_open_tag = Off
post_max_size = 30M
upload_max_filesize = 20M
mcrypt 설치
sudo apt -y install php7.4-mcrypt
sudo apt install php7.4-dev
sudo apt -y install gcc make autoconf libc-dev pkg-config
sudo apt-get -y install libmcrypt-dev
sudo pecl install mcrypt-1.0.3
sudo pecl install mcrypt
echo "extension=mcrypt.so" > /etc/php/7.4/mods-available/mcrypt.ini
ln -s /etc/php/7.4/mods-available/mcrypt.ini /etc/php/7.4/cli/conf.d/20-mcrypt.ini
ln -s /etc/php/7.4/mods-available/mcrypt.ini /etc/php/7.4/fpm/conf.d/20-mcrypt.ini
php -m
설치확인
ubuntu@ip-172-31-10-166:~$ apt --installed list *php*
Listing... Done
php-common/jammy,now 2:95+ubuntu22.04.1+deb.sury.org+1 all [installed]
php7.4-cli/jammy,now 1:7.4.33-15+ubuntu22.04.1+deb.sury.org+1 amd64 [installed]
php7.4-common/jammy,now 1:7.4.33-15+ubuntu22.04.1+deb.sury.org+1 amd64 [installed,automatic]
php7.4-curl/jammy,now 1:7.4.33-15+ubuntu22.04.1+deb.sury.org+1 amd64 [installed]
php7.4-fpm/jammy,now 1:7.4.33-15+ubuntu22.04.1+deb.sury.org+1 amd64 [installed]
php7.4-gd/jammy,now 1:7.4.33-15+ubuntu22.04.1+deb.sury.org+1 amd64 [installed]
php7.4-json/jammy,now 1:7.4.33-15+ubuntu22.04.1+deb.sury.org+1 amd64 [installed,automatic]
php7.4-mbstring/jammy,now 1:7.4.33-15+ubuntu22.04.1+deb.sury.org+1 amd64 [installed]
php7.4-mcrypt/jammy,now 3:1.0.7-5+ubuntu22.04.1+deb.sury.org+1 amd64 [installed]
php7.4-mysql/jammy,now 1:7.4.33-15+ubuntu22.04.1+deb.sury.org+1 amd64 [installed]
php7.4-opcache/jammy,now 1:7.4.33-15+ubuntu22.04.1+deb.sury.org+1 amd64 [installed]
php7.4-readline/jammy,now 1:7.4.33-15+ubuntu22.04.1+deb.sury.org+1 amd64 [installed,automatic]
php7.4-xml/jammy,now 1:7.4.33-15+ubuntu22.04.1+deb.sury.org+1 amd64 [installed]
php7.4-xmlrpc/jammy,now 1:7.4.33-15+ubuntu22.04.1+deb.sury.org+1 amd64 [installed]
php7.4-zip/jammy,now 1:7.4.33-15+ubuntu22.04.1+deb.sury.org+1 amd64 [installed]
php7.4/jammy,now 1:7.4.33-15+ubuntu22.04.1+deb.sury.org+1 all [installed]
ubuntu@ip-172-31-10-166:~$ php -v
PHP 7.4.33 (cli) (built: Sep 27 2024 04:13:27) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies
ubuntu@ip-172-31-10-166:~$
nginx
sudo apt install nginx
mysql 설치
sudo apt update
sudo apt install wget -y
wget https://dev.mysql.com/get/mysql-apt-config_0.8.12-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.12-1_all.deb
-> Ubuntu Bionic -> MySQL 5.7 -> OK
sudo apt-get update
sudo apt-cache policy mysql-server
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys [받으키]
sudo apt update
sudo apt install -f mysql-client=5.7* mysql-community-server=5.7* mysql-server=5.7*
sudo mysql_secure_installation
유저 생성
sudo su
mysql -u root -p
create database DB default charset `utf8`;
CREATE USER 'DB'@'%' identified by '패스워드';
GRANT ALL PRIVILEGES ON *.* to '유저'@'%';
GRANT ALL PRIVILEGES ON DB.* TO '유저'@'localhost';
FLUSH PRIVILEGES;
mysql 외부접속 및 언어 설정
vi /etc/mysql/mysql.conf.d/mysql.cnf
bind-address = 127.0.0.1 -> 0.0.0.0
추가
character-set-server = utf8
collation-server = utf8_general_ci
init_connect = set names utf8
vi /etc/mysql/conf.d/mysql.cnf
[mysql]
default-character-set=utf8
[client]
default-character-set=utf8
[mysqldump]
default-character-set=utf8
재 실행
sudo systemctl restart mysql
https
sudo su
apt-get -y install certbot
certbot certonly --standalone -d 도메인
root@ip-172-31-10-166:/etc/nginx/sites-available# systemctl stop nginx
root@ip-172-31-10-166:/etc/nginx/sites-available# certbot certonly --standalone -d 도메인
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Requesting a certificate for 도메인
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/도메인/fullchain.pem
Key is saved at: /etc/letsencrypt/live/도메인/privkey.pem
This certificate expires on 2025-01-17.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.
We were unable to subscribe you the EFF mailing list. You can try again later by visiting https://act.eff.org.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
* Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
* Donating to EFF: https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
root@ip-172-31-10-166:/etc/nginx/sites-available#
'Programming > php' 카테고리의 다른 글
phalcon 팔콘. (0) | 2018.01.29 |
---|---|
개발자 도구. (0) | 2018.01.29 |