Contents
개인 서버에 Ubuntu LEMP WORDPRESS 설치하기 6
개인 서버에 Ubuntu sever LEMP(Linux-ubuntu+Nginx+MariaDB-Phpmyadmin+PHP8.3) WORDPRESS 설치하기
웹 서버 Nginx는 고성는, 고가용성, 유연성을 제공하는 오픈 소스 웹 서버 소프트웨어입니다. 이 소프트웨어는 웹 서버 기능 뿐만 아니라 리버스 프록시, 메일 프록시, 일반 TCP/UDP 프록시 서버로도 사용할 수 있습니다. Nginx는 비동기 이벤트 기반 구조를 사용하여 동시에 많은 연결을 효율적으로 처리할 수 있으며, 이는 고성능 웹 사이트와 웹 애플리케이션을 호스팅하는 데 매우 적합합니다.
6-1. 웹 서버 Nginx 설치
우선 nginx의 설치 여부 및 현재 환경을 확인합니다.
명령어 창에서 sudo apt-cache policy nginx 를 입력해 봅니다.
설치 되어 있지 않으면 다음과 같이 출력됩니다.
junewoo@cvilla:~$ sudo apt-cache policy nginx
nginx:
Installed: (none)
Candidate: 1.18.0-6ubuntu14.4
Version table:
1.18.0-6ubuntu14.4 500
500 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
1.18.0-6ubuntu14 500
500 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
junewoo@cvilla:~$
보시면 현재 설치 되어 있지 않으며, 해당 우분투는 14.4 버전이 있음을 알 수 있습니다.
6-2. 내용의 확인과 nginx 설치
명령어에서 sudo apt install nginx 를 입력합니다.
junewoo@cvilla:~$ sudo apt install nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
grub-pc-bin
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0 libjpeg-turbo8 libjpeg8 libnginx-mod-http-geoip
libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter libnginx-mod-mail libnginx-mod-stream libtiff5 libwebp6 libxpm4
nginx-common nginx-core
Suggested packages:
libgd-tools fcgiwrap nginx-doc ssl-cert
The following NEW packages will be installed:
fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0 libjpeg-turbo8 libjpeg8 libnginx-mod-http-geoip
libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter libnginx-mod-mail libnginx-mod-stream libtiff5 libwebp6 libxpm4
nginx nginx-common nginx-core
0 upgraded, 18 newly installed, 0 to remove and 0 not upgraded.
Need to get 2462 kB of archives.
After this operation, 8210 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libjpeg-turbo8 amd64 1.5.2-0ubuntu5.18.04.3 [110 kB]
Get:2 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 fonts-dejavu-core all 2.37-1 [1041 kB]
Get:3 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 fontconfig-config all 2.12.6-0ubuntu2 [55.8 kB]
Get:4 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 libfontconfig1 amd64 2.12.6-0ubuntu2 [137 kB]
Get:5 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 libjpeg8 amd64 8c-2ubuntu8 [2194 B]
Get:6 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 libjbig0 amd64 2.1-3.1build1 [26.7 kB]
Get:7 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libtiff5 amd64 4.0.9-5ubuntu0.3 [153 kB]
Get:8 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 libwebp6 amd64 0.6.1-2 [185 kB]
Get:9 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic/main amd64 libxpm4 amd64 1:3.5.12-1 [34.0 kB]
Get:10 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libgd3 amd64 2.2.5-4ubuntu0.4 [119 kB]
Get:11 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic-updates/main amd64 nginx-common all 1.14.0-0ubuntu1.7 [37.4 kB]
Get:12 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libnginx-mod-http-geoip amd64 1.14.0-0ubuntu1.7 [11.2 kB]
Get:13 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libnginx-mod-http-image-filter amd64 1.14.0-0ubuntu1.7 [14.6 kB]
Get:14 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libnginx-mod-http-xslt-filter amd64 1.14.0-0ubuntu1.7 [13.0 kB]
Get:15 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libnginx-mod-mail amd64 1.14.0-0ubuntu1.7 [41.8 kB]
Get:16 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libnginx-mod-stream amd64 1.14.0-0ubuntu1.7 [63.7 kB]
Get:17 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic-updates/main amd64 nginx-core amd64 1.14.0-0ubuntu1.7 [413 kB]
Get:18 http://ap-seoul-1-ad-1.clouds.archive.ubuntu.com/ubuntu bionic-updates/main amd64 nginx all 1.14.0-0ubuntu1.7 [3596 B]
Fetched 2462 kB in 11s (228 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libjpeg-turbo8:amd64.
(Reading database ... 100848 files and directories currently installed.)
Preparing to unpack .../00-libjpeg-turbo8_1.5.2-0ubuntu5.18.04.3_amd64.deb ...
Unpacking libjpeg-turbo8:amd64 (1.5.2-0ubuntu5.18.04.3) ...
Selecting previously unselected package fonts-dejavu-core.
Preparing to unpack .../01-fonts-dejavu-core_2.37-1_all.deb ...
Unpacking fonts-dejavu-core (2.37-1) ...
Selecting previously unselected package fontconfig-config.
Preparing to unpack .../02-fontconfig-config_2.12.6-0ubuntu2_all.deb ...
Unpacking fontconfig-config (2.12.6-0ubuntu2) ...
Selecting previously unselected package libfontconfig1:amd64.
Preparing to unpack .../03-libfontconfig1_2.12.6-0ubuntu2_amd64.deb ...
Unpacking libfontconfig1:amd64 (2.12.6-0ubuntu2) ...
Selecting previously unselected package libjpeg8:amd64.
Preparing to unpack .../04-libjpeg8_8c-2ubuntu8_amd64.deb ...
Unpacking libjpeg8:amd64 (8c-2ubuntu8) ...
Selecting previously unselected package libjbig0:amd64.
Preparing to unpack .../05-libjbig0_2.1-3.1build1_amd64.deb ...
Unpacking libjbig0:amd64 (2.1-3.1build1) ...
Selecting previously unselected package libtiff5:amd64.
Preparing to unpack .../06-libtiff5_4.0.9-5ubuntu0.3_amd64.deb ...
Unpacking libtiff5:amd64 (4.0.9-5ubuntu0.3) ...
Selecting previously unselected package libwebp6:amd64.
Preparing to unpack .../07-libwebp6_0.6.1-2_amd64.deb ...
Unpacking libwebp6:amd64 (0.6.1-2) ...
Selecting previously unselected package libxpm4:amd64.
Preparing to unpack .../08-libxpm4_1%3a3.5.12-1_amd64.deb ...
Unpacking libxpm4:amd64 (1:3.5.12-1) ...
Selecting previously unselected package libgd3:amd64.
Preparing to unpack .../09-libgd3_2.2.5-4ubuntu0.4_amd64.deb ...
Unpacking libgd3:amd64 (2.2.5-4ubuntu0.4) ...
Selecting previously unselected package nginx-common.
Preparing to unpack .../10-nginx-common_1.14.0-0ubuntu1.7_all.deb ...
Unpacking nginx-common (1.14.0-0ubuntu1.7) ...
Selecting previously unselected package libnginx-mod-http-geoip.
Preparing to unpack .../11-libnginx-mod-http-geoip_1.14.0-0ubuntu1.7_amd64.deb ...
Unpacking libnginx-mod-http-geoip (1.14.0-0ubuntu1.7) ...
Selecting previously unselected package libnginx-mod-http-image-filter.
Preparing to unpack .../12-libnginx-mod-http-image-filter_1.14.0-0ubuntu1.7_amd64.deb ...
Unpacking libnginx-mod-http-image-filter (1.14.0-0ubuntu1.7) ...
Selecting previously unselected package libnginx-mod-http-xslt-filter.
Preparing to unpack .../13-libnginx-mod-http-xslt-filter_1.14.0-0ubuntu1.7_amd64.deb ...
Unpacking libnginx-mod-http-xslt-filter (1.14.0-0ubuntu1.7) ...
Selecting previously unselected package libnginx-mod-mail.
Preparing to unpack .../14-libnginx-mod-mail_1.14.0-0ubuntu1.7_amd64.deb ...
Unpacking libnginx-mod-mail (1.14.0-0ubuntu1.7) ...
Selecting previously unselected package libnginx-mod-stream.
Preparing to unpack .../15-libnginx-mod-stream_1.14.0-0ubuntu1.7_amd64.deb ...
Unpacking libnginx-mod-stream (1.14.0-0ubuntu1.7) ...
Selecting previously unselected package nginx-core.
Preparing to unpack .../16-nginx-core_1.14.0-0ubuntu1.7_amd64.deb ...
Unpacking nginx-core (1.14.0-0ubuntu1.7) ...
Selecting previously unselected package nginx.
Preparing to unpack .../17-nginx_1.14.0-0ubuntu1.7_all.deb ...
Unpacking nginx (1.14.0-0ubuntu1.7) ...
Setting up libjbig0:amd64 (2.1-3.1build1) ...
Setting up fonts-dejavu-core (2.37-1) ...
Setting up nginx-common (1.14.0-0ubuntu1.7) ...
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /lib/systemd/system/nginx.service.
Setting up libjpeg-turbo8:amd64 (1.5.2-0ubuntu5.18.04.3) ...
Setting up libnginx-mod-mail (1.14.0-0ubuntu1.7) ...
Setting up libxpm4:amd64 (1:3.5.12-1) ...
Setting up libnginx-mod-http-xslt-filter (1.14.0-0ubuntu1.7) ...
Setting up libnginx-mod-http-geoip (1.14.0-0ubuntu1.7) ...
Setting up libwebp6:amd64 (0.6.1-2) ...
Setting up libjpeg8:amd64 (8c-2ubuntu8) ...
Setting up fontconfig-config (2.12.6-0ubuntu2) ...
Setting up libnginx-mod-stream (1.14.0-0ubuntu1.7) ...
Setting up libtiff5:amd64 (4.0.9-5ubuntu0.3) ...
Setting up libfontconfig1:amd64 (2.12.6-0ubuntu2) ...
Setting up libgd3:amd64 (2.2.5-4ubuntu0.4) ...
Setting up libnginx-mod-http-image-filter (1.14.0-0ubuntu1.7) ...
Setting up nginx-core (1.14.0-0ubuntu1.7) ...
Setting up nginx (1.14.0-0ubuntu1.7) ...
Processing triggers for systemd (237-3ubuntu10.41) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ufw (0.36-0ubuntu0.18.04.1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
junewoo@cvilla:~$
6-3. 다시 nginx 설치가 잘 되었는지 확인해 봅니다.
junewoo@cvilla:~$ sudo apt-cache policy nginx
[sudo] password for junewoo:
nginx:
Installed: 1.18.0-6ubuntu14.4
Candidate: 1.18.0-6ubuntu14.4
Version table:
*** 1.18.0-6ubuntu14.4 500
500 http://kr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
100 /var/lib/dpkg/status
1.18.0-6ubuntu14.3 500
500 http://kr.archive.ubuntu.com/ubuntu jammy-security/main amd64 Packages
1.18.0-6ubuntu14 500
500 http://kr.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
junewoo@cvilla:~$
보시면 Installed라고 떠 있는 것을 확인할 수 있습니다.
이제 서버에 접속이 되는지 확인해 보겠습니다.
6-4. 현재 iptables 규칙 초기화
명령 창에서 sudo iptables -F를 입력합니다.
junewoo@cvilla:~$ sudo iptables -F
웹브라우저에서 IP주소를 입력하여 확인하여 봅니다.
Welcome to nginx!가 뜨면 정상적으로 nginx가 설치된 것입니다.
설치시 오류가 난 경우 apt-get으로 설치합니다.
먼저 apt-get을 업데이트 해 보겠습니다.
명령어 창에서 sudo apt-get update 를 입력합니다.
update후 명령어 창에서 sudo apt-get install nginx 를 입력해 보시기 바랍니다.
그래도 설치 시 오류가 나신다면 아마도 우분투 패키지 업데이트 및 업그레이드가 되지 않아 나타나는 현상입니다.
명령어 창에서 sudo apt update 와 sudo apt upgrade를 실행해 보시기 바랍니다.
junewoo@cvilla:~$ sudo apt update
[sudo] password for junewoo:
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,424 kB]
Get:6 http://kr.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1,053 kB]
Get:7 http://kr.archive.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1,208 kB]
Hit:8 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy InRelease
Ign:9 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic InRelease
Ign:9 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic InRelease
Ign:9 https://ftp.harukasan.org/mariadb/repo/10.4/ubuntu bionic InRelease
Err:9 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 3,914 kB in 38s (103 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.
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:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
libmagickwand-6.q16-6 libmagickcore-6.q16-6 imagemagick-6-common
Learn more about Ubuntu Pro at https://ubuntu.com/pro
The following packages have been kept back:
libgpgme11
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
junewoo@cvilla:~$