---
# System prepended metadata

title: Untitled

---

HW 06
1、先更新
sudo apt update
sudo apt upgrade
![](https://i.imgur.com/FO4i65q.png)

2、
安裝nginx
sudo apt install nginx
![](https://i.imgur.com/qxUNORu.png)

3、
安裝PHP
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php8.1 (有更新的)'
![](https://i.imgur.com/L79QQeF.png)
![](https://i.imgur.com/kz9K8Dr.png)

4、
安裝PHP-FPM
sudo apt install php8.1-fpm

確認php狀態
sudo systemctl status php8.1-fpm
![](https://i.imgur.com/Z4nvW1Q.png)

![](https://i.imgur.com/TDB6DnR.png)

5、
安裝MySQL
sudo apt-get install mysql-server
![](https://i.imgur.com/1L192XA.png)

![](https://i.imgur.com/wWPstOd.png)


6、
安裝 Additional Packages
sudo apt search php8.1-*
sudo apt install php8.1-mysql php8.1-curl php8.1-xml
![](https://i.imgur.com/d46SqRU.png)
![](https://i.imgur.com/u2TMIU0.png)


7、
修改  Nginx VirtualHost
![](https://i.imgur.com/St8wIip.png)

![](https://i.imgur.com/Kkn4vNc.png)


我後面一直遇到問題，結果是這邊修改錯誤

![](https://i.imgur.com/PjddoDO.png)
我的sever_name _; 這邊要有空格

8、
寫一個PHP
內容是
```
<?php
  phpinfo();
?>
```
![](https://i.imgur.com/AqP7oPy.png)

9、

跑出來了~

![](https://i.imgur.com/cwCeApi.png)








