개인 서버에 Ubuntu LEMP WORDPRESS 설치하기 8

Contents

1. 개인 서버 만들기, 파워, 케이스, 메인보드, CPU쿨러, SSD, 메모리(RAM), CPU 선정과 주문 조립
2. 공유기 설정하기, 공유기1 브릿지 모드 설정, iptime 공유기2 IPTV 연결 설정
3. 개인 서버에 Ubuntu 22.04.4 LTS 설치하기, Universal-USB-Installer를 사용하여 부팅 가능한 USB를 생성하기
4. 개인 PC에 우분투 서버 접속용 3가지 SSH 설치, 자료실의 Putty, EditPlus, FileZilla 다운 후 설치하기
5. 우분투 서버 환경 date 설정하기
6. 웹 서버 Nginx 설치, 현재 iptables 규칙 초기화
7. Ubuntu sever 폴더 권한 설정, Nginx 페이지의 내용 수정과 권한 설정
8. Nginx 서버에 PHP8.3 설치, 자주 쓰이는 php8.3 모듈 설치하기
9. apt update와 upgrade가 완료 후 mariadb를 설치하기
10. MariaDB 관리 도구 phpMyAdmin 설치하기
11. 아사달에서 도메인 연결하기, 카페24에서 도메인 연결하기
12. HTTPS 적용을 위한 SSL 인증서 발급, Nginx에 acme-challenge 폴더 위치를 알리기 위하여 letsencrypt.conf 파일 만들기, Let’s Encrypt SSL 발급 받기
13. MariaDB에서 데이터베이스(DB) 만들기, phpMyAdmin에서 DB생성
14. 워드프레스 설치, 우분투 서버에 ko.wordpress.org/latest-ko_KR.zip 파일 설치, wordpress.zip 파일 압축 풀기, 서버 폴더 소유자 권한 및 사용자 그룹 변경
15. 워드프레스 설치 후 환경 설정, 우분투 서버에 wp-config.php에 임시디렉토리 설정, FTP 연결 정보 입력, Putty로 php.ini, nginx.conf를 수정

개인 서버에 Ubuntu LEMP WORDPRESS 설치하기 8

개인 서버에 Ubuntu sever LEMP(Linux-ubuntu+Nginx+MariaDB-Phpmyadmin+PHP8.3) WORDPRESS 설치하기

PHP7과 PHP8는 몇 가지 차이점이 있습니다. 1.성능 향상, 2.새로운 기능 추가, 3.타입 시스템 개선, 4.문법 개선 등의 차이점이 있습니다. 이러한 변화는 PHP 애플리케이션의 성능을 크게 향상 시키고, 개발자들이 더 효율적이고 안전한 코드를 작성할 수 있도록 도와줍니다.

  • PHP 7 : Zend Engine 3을 도입하여 PHP 5.6 대비 약 2배의 성능 향상을 제공합니다. 메모리 사용량도 줄어듭니다.
  • PHP 7 : 타입 선언이 강화되어 스칼라 타입(예: int, float, string, bool)을 함수의 매개변수와 반환 값에 사용할 수 있게 되었습니다. 또한, 엄격한 타입 모드(strict mode)를 지원합니다.
  • PHP 8 : JIT(Just In Time) 컴파일러가 도입되어 특정 상황에서 성능이 크게 향상될 수 있습니다. 특히, CPU 바운드 연산에서 그 차이가 두드러집니다.
  • PHP 8 : 유니온 타입, mixed 타입 등이 추가되어 더욱 유연한 타입 선언이 가능해졌습니다. 또한, 이름이 있는 인자(named arguments), match 표현식 등 새로운 문법이 도입되어 코드의 가독성과 유지 보수성이 향상되었습니다.

8-1. Nginx 서버에 PHP8 설치를 하겠습니다.

현재 서버 상태를 확인하기 위해서, 명령창에 sudo apt-cache policy php 라고 입력합니다.

junewoo@cvilla:~$ sudo apt-cache policy php

현재 인스톨은 되어 있지 않으며 8.3 버전에 대한 설치 정보를 가지고 있다고 합니다.

php:
  Installed: (none)
  Candidate: 2:8.3+94+ubuntu22.04.1+deb.sury.org+2
  Version table:
     2:8.3+94+ubuntu2 500
        500 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

8-2. 최신 버전의 php를 설치하기 위하여 apt 정책을 최신으로 업데이트 해보겠습니다.

명령창에 sudo add-apt-repository ppa:ondrej/php 라고 입력합니다.

junewoo@cvilla:~$ sudo add-apt-repository ppa:ondrej/php
PPA publishes dbgsym, you may need to include 'main/debug' component
Repository: 'deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu/ jammy main'
Description:
Co-installable PHP versions: PHP 5.6, PHP 7.x, PHP 8.x and most requested extensions are included. Only Supported Versions of PHP (http://php.net/supported-versions.php) for Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided. Don't ask for end-of-life PHP versions or Ubuntu release, they won't be provided.

Debian oldstable and stable packages are provided as well: https://deb.sury.org/#debian-dpa

You can get more information about the packages at https://deb.sury.org

IMPORTANT: The -backports is now required on older Ubuntu releases.

BUGS&FEATURES: This PPA now has a issue tracker:
https://deb.sury.org/#bug-reporting

CAVEATS:
1. If you are using php-gearman, you need to add ppa:ondrej/pkg-gearman
2. If you are using apache2, you are advised to add ppa:ondrej/apache2
3. If you are using nginx, you are advised to add ppa:ondrej/nginx-mainline
   or ppa:ondrej/nginx

PLEASE READ: If you like my work and want to give me a little motivation, please consider donating regularly: https://donate.sury.org/

WARNING: add-apt-repository is broken with non-UTF-8 locales, see
https://github.com/oerdnj/deb.sury.org/issues/56 for workaround:

# LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
More info: https://launchpad.net/~ondrej/+archive/ubuntu/php
Adding repository.
Press [ENTER] to continue or Ctrl-c to cancel.
Found existing deb entry in /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list
Adding deb entry to /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list
Found existing deb-src entry in /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list
Adding disabled deb-src entry to /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list
Adding key to /etc/apt/trusted.gpg.d/ondrej-ubuntu-php.gpg with fingerprint 14AA40EC0831756756D7F66C4F4EA0AAE5267A6C
Hit:1 http://kr.archive.ubuntu.com/ubuntu jammy InRelease
Get:2 http://kr.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Hit:3 http://kr.archive.ubuntu.com/ubuntu jammy-backports InRelease
Get:4 http://kr.archive.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Get:5 http://kr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [1,433 kB]
Get:6 http://kr.archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [1,523 kB]
Get:7 http://kr.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1,053 kB]
Hit:8 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy InRelease
Get:9 http://kr.archive.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1,217 kB]
Get:10 http://kr.archive.ubuntu.com/ubuntu jammy-security/main Translation-en [220 kB]
Get:11 http://kr.archive.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [1,495 kB]
Get:12 http://kr.archive.ubuntu.com/ubuntu jammy-security/restricted Translation-en [248 kB]
Ign:13 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic InRelease
Ign:13 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic InRelease
Ign:13 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic InRelease
Err:13 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic InRelease
  Cannot initiate the connection to ftp.harukasan.org:443 (2001:470:23:440::2). - connect (101: Network is unreachable) Could not connect to ftp.harukasan.org:443 (175.214.128.79). - connect (111: Connection refused) Could not connect to ftp.harukasan.org:443 (118.38.208.102), connection timed out
Fetched 7,419 kB in 38s (195 kB/s)
Reading package lists... Done
W: Failed to fetch https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu/dists/bionic/InRelease  Cannot initiate the connection to ftp.harukasan.org:443 (2001:470:23:440::2). - connect (101: Network is unreachable) Could not connect to ftp.harukasan.org:443 (175.214.128.79). - connect (111: Connection refused) Could not connect to ftp.harukasan.org:443 (118.38.208.102), connection timed out
W: Some index files failed to download. They have been ignored, or old ones used instead.
junewoo@cvilla:~$

 

중간에 Press [ENTER] to continue or Ctrl-c to cancel adding it. 라고 나오는데 docker 등 필수 패키지 정보를 설치하겠다는 겁니다. 여기서 ENTER를 누르시면 됩니다.

8-3. 다음으로 apt-get도 업데이트 합니다.

명령창에 sudo apt-get update 라고 입력합니다.

junewoo@cvilla:~$ sudo apt-get update
Hit:1 http://kr.archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://kr.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:3 http://kr.archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:4 http://kr.archive.ubuntu.com/ubuntu jammy-security InRelease
Hit:5 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy InRelease
Ign:6 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic InRelease
Ign:6 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic InRelease
Ign:6 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic InRelease
Err:6 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic InRelease
  Cannot initiate the connection to ftp.harukasan.org:443 (2001:470:23:440::2). - connect (101: Network is unreachable) Could not connect to ftp.harukasan.org:443 (175.214.128.79). - connect (111: Connection refused) Could not connect to ftp.harukasan.org:443 (118.38.208.102), connection timed out
Reading package lists... Done
W: Failed to fetch https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu/dists/bionic/InRelease  Cannot initiate the connection to ftp.harukasan.org:443 (2001:470:23:440::2). - connect (101: Network is unreachable) Could not connect to ftp.harukasan.org:443 (175.214.128.79). - connect (111: Connection refused) Could not connect to ftp.harukasan.org:443 (118.38.208.102), connection timed out
W: Some index files failed to download. They have been ignored, or old ones used instead.
junewoo@cvilla:~$

 

8-4. 다음 서버의 php에 대한 apt 캐시 정책을 재확인합니다.

명령창에 다시 한번 sudo apt-cache policy php 라고 입력합니다.

Last login: Wed Mar  6 21:17:30 2024 from 192.168.0.1
junewoo@cvilla:~$ sudo apt-cache policy php
php:
  Installed: (none)
  Candidate: 2:8.3+94+ubuntu22.04.1+deb.sury.org+2
  Version table:
     2:8.3+94+ubuntu22.04.1+deb.sury.org+2 500
        500 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 Packages
     2:8.1+92ubuntu1 500
        500 http://kr.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
junewoo@cvilla:~$

 

8-5. 최신 버전이 8.3로 확인 되어 php8(php8.3)을 설치해 보겠습니다.

기타 8.2나 8.0 버전을 설치하시고자 하시면 php8.2-fpm이나 php8.0-fpm으로 변경하여 입력하시면 됩니다.

중간에 After this operation, 18.7 MB of additional disk space will be used. 라고 물으며 이어서 할 것이냐고 묻습니다.

Do you want to continue? [Y/n] 여기서 Y를 하시면 됩니다.

명령창에 sudo apt-get install php8.3-fpm 라고 입력합니다.

junewoo@cvilla:~$ sudo apt-get install php8.3-fpm
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  php8.3-cli php8.3-common php8.3-opcache php8.3-readline
Suggested packages:
  php-pear
The following NEW packages will be installed:
  php8.3-cli php8.3-common php8.3-fpm php8.3-opcache php8.3-readline
0 upgraded, 5 newly installed, 0 to remove and 1 not upgraded.
Need to get 4,992 kB of archives.
After this operation, 22.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.3-common amd64 8.3.3-1+ubuntu22.04.1+deb.sury.org+1 [755 kB]
Get:2 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.3-opcache amd64 8.3.3-1+ubuntu22.04.1+deb.sury.org+1 [370 kB]
Get:3 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.3-readline amd64 8.3.3-1+ubuntu22.04.1+deb.sury.org+1 [13.6 kB]
Get:4 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.3-cli amd64 8.3.3-1+ubuntu22.04.1+deb.sury.org+1 [1,923 kB]
Get:5 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.3-fpm amd64 8.3.3-1+ubuntu22.04.1+deb.sury.org+1 [1,929 kB]
Fetched 4,992 kB in 17s (286 kB/s)
Selecting previously unselected package php8.3-common.
(Reading database ... 113652 files and directories currently installed.)
Preparing to unpack .../php8.3-common_8.3.3-1+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.3-common (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...
Selecting previously unselected package php8.3-opcache.
Preparing to unpack .../php8.3-opcache_8.3.3-1+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.3-opcache (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...
Selecting previously unselected package php8.3-readline.
Preparing to unpack .../php8.3-readline_8.3.3-1+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.3-readline (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...
Selecting previously unselected package php8.3-cli.
Preparing to unpack .../php8.3-cli_8.3.3-1+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.3-cli (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...
Selecting previously unselected package php8.3-fpm.
Preparing to unpack .../php8.3-fpm_8.3.3-1+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.3-fpm (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...
Setting up php8.3-common (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...

Creating config file /etc/php/8.3/mods-available/calendar.ini with new version

Creating config file /etc/php/8.3/mods-available/ctype.ini with new version

Creating config file /etc/php/8.3/mods-available/exif.ini with new version

Creating config file /etc/php/8.3/mods-available/fileinfo.ini with new version

Creating config file /etc/php/8.3/mods-available/ffi.ini with new version

Creating config file /etc/php/8.3/mods-available/ftp.ini with new version

Creating config file /etc/php/8.3/mods-available/gettext.ini with new version

Creating config file /etc/php/8.3/mods-available/iconv.ini with new version

Creating config file /etc/php/8.3/mods-available/pdo.ini with new version

Creating config file /etc/php/8.3/mods-available/phar.ini with new version

Creating config file /etc/php/8.3/mods-available/posix.ini with new version

Creating config file /etc/php/8.3/mods-available/shmop.ini with new version

Creating config file /etc/php/8.3/mods-available/sockets.ini with new version

Creating config file /etc/php/8.3/mods-available/sysvmsg.ini with new version

Creating config file /etc/php/8.3/mods-available/sysvsem.ini with new version

Creating config file /etc/php/8.3/mods-available/sysvshm.ini with new version

Creating config file /etc/php/8.3/mods-available/tokenizer.ini with new version
Setting up php8.3-readline (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...

Creating config file /etc/php/8.3/mods-available/readline.ini with new version
Setting up php8.3-opcache (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...

Creating config file /etc/php/8.3/mods-available/opcache.ini with new version
Setting up php8.3-cli (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...
update-alternatives: using /usr/bin/php8.3 to provide /usr/bin/php (php) in auto mode
update-alternatives: using /usr/bin/phar8.3 to provide /usr/bin/phar (phar) in auto mode
update-alternatives: using /usr/bin/phar.phar8.3 to provide /usr/bin/phar.phar (phar.phar) in auto mode

Creating config file /etc/php/8.3/cli/php.ini with new version
Setting up php8.3-fpm (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...

Creating config file /etc/php/8.3/fpm/php.ini with new version
Created symlink /etc/systemd/system/multi-user.target.wants/php8.3-fpm.service → /lib/systemd/system/php8.3-fpm.service.
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for php8.3-cli (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...
Processing triggers for php8.3-fpm (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...
Scanning processes...
Scanning candidates...
Scanning processor microcode...
Scanning linux images...

Running kernel seems to be up-to-date.

The processor microcode seems to be up-to-date.

Restarting services...
Service restarts being deferred:
 /etc/needrestart/restart.d/dbus.service
 systemctl restart networkd-dispatcher.service
 systemctl restart systemd-logind.service
 systemctl restart unattended-upgrades.service

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.
junewoo@cvilla:~$

 

8-6. 다음으로 그 외 자주 쓰이는 php8.3 모듈을 설치해 보겠습니다.

명령창에 sudo apt-get install php8.3-curl php8.3-gd php8.3-mysql php8.3-mbstring php8.3-xml php8.3-zip php8.3-imagick php8.3-bcmath -y zip unzip 를 입력합니다.

After this operation, 3509 kB of additional disk space will be used. 라고 물으며 이어서 설치 할 것인지 묻습니다.

Do you want to continue? [Y/n] 이렇게 나오면 Y를 선택합니다.

junewoo@cvilla:~$ sudo apt-get install php8.3-curl php8.3-gd php8.3-mysql php8.3-mbstring php8.3-xml php8.3-zip php8.3-imagick php8.3-bcmath -y zip unzip
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
zip is already the newest version (3.0-12build2).
unzip is already the newest version (6.0-26ubuntu3.2).
The following NEW packages will be installed:
  php8.3-bcmath php8.3-curl php8.3-gd php8.3-imagick php8.3-mbstring
  php8.3-mysql php8.3-xml php8.3-zip
0 upgraded, 8 newly installed, 0 to remove and 1 not upgraded.
Need to get 1,043 kB of archives.
After this operation, 3,240 kB of additional disk space will be used.
Get:1 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.3-imagick amd64 3.7.0-4+ubuntu22.04.1+deb.sury.org+2 [125 kB]
Get:2 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.3-bcmath amd64 8.3.3-1+ubuntu22.04.1+deb.sury.org+1 [16.8 kB]
Get:3 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.3-curl amd64 8.3.3-1+ubuntu22.04.1+deb.sury.org+1 [40.5 kB]
Get:4 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.3-gd amd64 8.3.3-1+ubuntu22.04.1+deb.sury.org+1 [32.9 kB]
Get:5 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.3-mbstring amd64 8.3.3-1+ubuntu22.04.1+deb.sury.org+1 [538 kB]
Get:6 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.3-mysql amd64 8.3.3-1+ubuntu22.04.1+deb.sury.org+1 [131 kB]
Get:7 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.3-xml amd64 8.3.3-1+ubuntu22.04.1+deb.sury.org+1 [129 kB]
Get:8 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 php8.3-zip amd64 8.3.3-1+ubuntu22.04.1+deb.sury.org+1 [30.4 kB]
Fetched 1,043 kB in 6s (184 kB/s)
Selecting previously unselected package php8.3-imagick.
(Reading database ... 113766 files and directories currently installed.)
Preparing to unpack .../0-php8.3-imagick_3.7.0-4+ubuntu22.04.1+deb.sury.org+2_amd64.deb ...
Unpacking php8.3-imagick (3.7.0-4+ubuntu22.04.1+deb.sury.org+2) ...
Selecting previously unselected package php8.3-bcmath.
Preparing to unpack .../1-php8.3-bcmath_8.3.3-1+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.3-bcmath (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...
Selecting previously unselected package php8.3-curl.
Preparing to unpack .../2-php8.3-curl_8.3.3-1+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.3-curl (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...
Selecting previously unselected package php8.3-gd.
Preparing to unpack .../3-php8.3-gd_8.3.3-1+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.3-gd (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...
Selecting previously unselected package php8.3-mbstring.
Preparing to unpack .../4-php8.3-mbstring_8.3.3-1+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.3-mbstring (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...
Selecting previously unselected package php8.3-mysql.
Preparing to unpack .../5-php8.3-mysql_8.3.3-1+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.3-mysql (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...
Selecting previously unselected package php8.3-xml.
Preparing to unpack .../6-php8.3-xml_8.3.3-1+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.3-xml (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...
Selecting previously unselected package php8.3-zip.
Preparing to unpack .../7-php8.3-zip_8.3.3-1+ubuntu22.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php8.3-zip (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...
Setting up php8.3-curl (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...

Creating config file /etc/php/8.3/mods-available/curl.ini with new version
Setting up php8.3-zip (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...

Creating config file /etc/php/8.3/mods-available/zip.ini with new version
Setting up php8.3-mysql (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...

Creating config file /etc/php/8.3/mods-available/mysqlnd.ini with new version

Creating config file /etc/php/8.3/mods-available/mysqli.ini with new version

Creating config file /etc/php/8.3/mods-available/pdo_mysql.ini with new version
Setting up php8.3-mbstring (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...

Creating config file /etc/php/8.3/mods-available/mbstring.ini with new version
Setting up php8.3-bcmath (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...

Creating config file /etc/php/8.3/mods-available/bcmath.ini with new version
Setting up php8.3-xml (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...

Creating config file /etc/php/8.3/mods-available/dom.ini with new version

Creating config file /etc/php/8.3/mods-available/simplexml.ini with new version

Creating config file /etc/php/8.3/mods-available/xml.ini with new version

Creating config file /etc/php/8.3/mods-available/xmlreader.ini with new version

Creating config file /etc/php/8.3/mods-available/xmlwriter.ini with new version

Creating config file /etc/php/8.3/mods-available/xsl.ini with new version
Setting up php8.3-imagick (3.7.0-4+ubuntu22.04.1+deb.sury.org+2) ...
Setting up php8.3-gd (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...

Creating config file /etc/php/8.3/mods-available/gd.ini with new version
Processing triggers for php8.3-fpm (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...
Processing triggers for php8.3-cli (8.3.3-1+ubuntu22.04.1+deb.sury.org+1) ...
Scanning processes...
Scanning candidates...
Scanning processor microcode...
Scanning linux images...

Running kernel seems to be up-to-date.

The processor microcode seems to be up-to-date.

Restarting services...
Service restarts being deferred:
 /etc/needrestart/restart.d/dbus.service
 systemctl restart networkd-dispatcher.service
 systemctl restart systemd-logind.service
 systemctl restart unattended-upgrades.service

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.
junewoo@cvilla:~$

 

8-7. php8.3 설치가 완료 되었습니다. php 버전을 확인해 보겠습니다.

명령어 창에서 php -v 를 입력합니다.

junewoo@cvilla:~$ php -v
PHP 8.3.3-1+ubuntu22.04.1+deb.sury.org+1 (cli) (built: Feb 15 2024 18:38:52) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.3, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.3-1+ubuntu22.04.1+deb.sury.org+1, Copyright (c), by Zend Technologies
junewoo@cvilla:~$

php8.3 버전이 잘 설치되었다고 나타납니다.

php8.3 fpm을 시작합니다.  명령어 창에서 sudo service php8.3-fpm start 를 입력합니다.

junewoo@cvilla:~$ sudo service php8.3-fpm start
junewoo@cvilla:~$

 

지금까지 php는 설치되었으나, Nginx가 사실 웹 페이지(php)를 읽지는 못합니다. 웹서버인 Nginx가 php를 읽을 수 있도록 수정을 해 보겠습니다.

8-8. Nginx의 사용 권한을 확인하고 권한을 설정합니다.

명령어 창에서 ls -l /etc/nginx/sites-available/ 를 입력합니다.

junewoo@cvilla:~$ ls -l /etc/nginx/sites-available/ 
total 4
-rw-r--r-- 1 root root 2929 Dec 23 18:32 default

소유 권한도 root고 사용자 그룹도 root입니다.

명령어 창에서 sudo chgrp junewoo /etc/nginx/sites-available/default 를 입력 사용자 그룹 권한을 junewoo로 변경합니다.

명령어 창에서 sudo chmod 775 /etc/nginx/sites-available/default 를 입력하여 파일 권한을 775로 변경합니다.

junewoo@cvilla:~$ sudo chgrp ubuntu /etc/nginx/sites-available/default
junewoo@cvilla:~$ sudo chmod 775 /etc/nginx/sites-available/default
junewoo@cvilla:~$ ls -l /etc/nginx/sites-available/
total 4
-rw-rw-r-- 1 root junewoo 2929 Dec 23 18:38 default

이제 EditPlus에서 /etc/nginx/sites-available/ 에 위치한 default 파일을 수정할 수 있습니다.

junewoo@cvilla:~$ ls -l /etc/nginx/sites-avail
able/
total 4
-rwxrwxr-x 1 root junewoo 2929 Dec 23 18:40 default
junewoo@cvilla:~$

8-9. default 파일에서 index.php를 추가해 보겠습니다.

EditPlus에서 /etc/nginx/sites-available/default 파일을 열어서 index.php를 추가합니다.

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or WordPress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
	listen 80 default_server;
	listen [::]:80 default_server;

	# SSL configuration
	#
	# listen 443 ssl default_server;
	# listen [::]:443 ssl default_server;
	#
	# Note: You should disable gzip for SSL traffic.
	# See: https://bugs.debian.org/773332
	#
	# Read up on ssl_ciphers to ensure a secure configuration.
	# See: https://bugs.debian.org/765782
	#
	# Self signed certs generated by the ssl-cert package
	# Don't use them in a production server!
	#
	# include snippets/snakeoil.conf;

	root /var/www/html;

	# Add index.php to the list if you are using PHP
	index index.php index.html index.htm index.nginx-debian.html;

	server_name _;

그 다음 # pass PHP scripts to FastCGI server 아래에 PHP 설정파일의 경로와 보안설정을 추가합니다.

	# pass PHP scripts to FastCGI server
	location ~ \.php$ {
		include snippets/fastcgi-php.conf;
		fastcgi_pass unix:/run/php/php7.4-fpm.sock;
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
		include fastcgi_params;
		fastcgi_read_timeout 300;
	}

	location ~ /\.ht {
	    deny all;
	}

• default파일에 도메인 및 https(SSL 보안설정) 추가 시, 조금 더 내용을 추가 할 예정입니다.

8-10. nginx에 설정에 문제가 없는지 확인합니다.

명령어 창에서 sudo nginx -t 를 입력합니다.

/etc/nginx/nginx.conf syntax is ok        <- 에서 Nginx 설정의 문법이 문제 없다고 나옵니다.

/etc/nginx/nginx.conf test is successful  <- 에서 Nginx가 정상적으로 test 동작한다고 나옵니다.

junewoo@cvilla:~$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
junewoo@cvilla:~$

다음으로 Nginx를 재구동 하겠습니다.

명령어 창에서 sudo systemctl reload nginx 를 입력합니다.

명령어 창에서 sudo service nginx restart 를 입력합니다.

junewoo@cvilla:~$ sudo systemctl reload nginx
junewoo@cvilla:~$ sudo service nginx restart

이제 Nginx가 재구동 되었습니다.

8-11. php가 정상적으로 뜨는지 확인하겠습니다.

EditPlus에서 /var/www/html/에서 index.php를 만들어 봅니다.

파일들이 있는 곳(index.nginx-debian.html)에서 마우스 오른쪽을 눌러 새로 작성을 누릅니다.

그 후에 index.php를 입력합니다.

본문 안에 <?php phpinfo(); ?>를 입력하시면 됩니다. 모두 지우고 <?php phpinfo(); ?> 만 입력하셔도 됩니다.

8-12. 이제 http://ipaddress/index.php 를 입력하고 확인합니다.

php 8.3 버전이 설치된 화면이 나오면 됩니다. 아래 사진은 php 8.1.9 입니다.

다음에는 MariaDB를 설치해 보겠습니다.

9. 개인 서버에 Ubuntu LEMP WORDPRESS 설치하기

Leave a Comment