ubuntu 20.0 php 8.0 + nginx 설치
저는 윈도우10에서 wsl 개발환경 os로 우분투를 사용합니다.
그래서 저 같이 개발환경이 우분투를 사용하시는 분들에게
소소하게나마 우분투 설치를 간략하게 정리를 해보았습니다.
알고계신 분들도 있겠지만 모르시는분들을 위해서 우분투 20.0 환경에서
php8.0 + nginx를 설치를 하도록 하겠습니다.
1단계 우분투 시스템 패키지 추가
$ sudo apt update
$ sudo apt upgrade
$ sudo apt install ca-certificates apt-transport-https software-properties-common
|
2단계 PPA 저장소 추가
$ sudo add-apt-repository ppa:ondrej/php
|

3단계 PHP설치
PPA가 시작할수 있도록 시스템 레파지토리를 업데이트 합니다.
$ sudo apt update
|
php8.0 을 설치합니다.
$ sudo apt install php8.0
|
설치 중간에 Do you want continue [ Y / n ]라는 메세지가 나오는데 그냥 y 눌러주시면 됩니다.
그리고 설치가 완료되면 메세지를 자세히 보면 "Failed to start The Apache HTTP Server."라는 메세지가 나타납니다.
어차피 우리는 nginx로 세팅을 하기 때문에 이러한 메세지는 지나쳐 주셔도 무방합니다.

다음은 php-fpm8.0을 설치합니다.
$ sudo apt install php8.0-fpm
|
4단계 nginx 설치 및 설정
nginx 설치합니다.
$ sudo apt-get install nginx
|
nginx를 설치가 완료가 되었다면 php를 설정합니다.
| $ sudo vim /etc/nginx/sites-enabled/default |
vim에디터로 아래코드로 수정해 주시면됩니다.
server {
# ... some other code
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.0-fpm.sock;
}
}
|
필요한 확장모듈을 설치해주시면 됩니다. php8.0-[확장모듈명]
$ sudo apt install php8.0-snmp php-memcached php8.0-mysql
|
nginx를 시작해 주세요.
| $ sudo service nginx start |
마지막으로 php가 잘되었는지 확인을 위해 vim에디터로 test.php파일을 만듭니다.
$ sudo vim /var/www/html/test.php
|
test.php파일에 아래코드를 작성해줍니다.
<?php
phpinfo();
?>
|
이제 PHP8.0이 잘 설치가 되었는지 확인해 봅니다.
확인 경로 : http://[자신의 서버 ip]/test.php
아래 사진처럼 화면이 안나온다면 nginx설정이나 php가 설치가 제대로 안된것이기 때문에
그 부분을 다시 봐주시면 되겠습니다.

게시판 목록
개발자팁
질문은 QA에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 4946 | node.js | 6년 전 | 2607 | ||
| 4945 | node.js | 6년 전 | 2379 | ||
| 4944 | node.js | 6년 전 | 2519 | ||
| 4943 | node.js | 6년 전 | 2269 | ||
| 4942 | node.js | 6년 전 | 2245 | ||
| 4941 | node.js | 6년 전 | 2717 | ||
| 4940 | node.js | 6년 전 | 1867 | ||
| 4939 | node.js | 6년 전 | 1995 | ||
| 4938 | node.js | 6년 전 | 2457 | ||
| 4937 | node.js | 6년 전 | 2247 | ||
| 4936 | node.js | 6년 전 | 2318 | ||
| 4935 | node.js | 6년 전 | 2136 | ||
| 4934 | node.js | 6년 전 | 2440 | ||
| 4933 | node.js | 6년 전 | 2244 | ||
| 4932 | node.js | 6년 전 | 2686 | ||
| 4931 | node.js | 6년 전 | 2070 | ||
| 4930 | node.js | 6년 전 | 1998 | ||
| 4929 | node.js | 6년 전 | 8629 | ||
| 4928 | node.js | 6년 전 | 3749 | ||
| 4927 | node.js | 6년 전 | 2392 | ||
| 4926 | node.js | 6년 전 | 2504 | ||
| 4925 | node.js | 6년 전 | 2081 | ||
| 4924 | node.js | 6년 전 | 3372 | ||
| 4923 | node.js | 6년 전 | 2220 | ||
| 4922 | node.js | 6년 전 | 1989 | ||
| 4921 | node.js | 6년 전 | 2046 | ||
| 4920 | node.js | 6년 전 | 1764 | ||
| 4919 | node.js | 6년 전 | 2029 | ||
| 4918 | node.js | 6년 전 | 2176 | ||
| 4917 | node.js | 6년 전 | 2393 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기