---
# System prepended metadata

title: Nginx 與 php-fpm 配置
tags: [Nginx]

---

# Nginx 與 php-fpm 配置
從 default 複製過來要改的地方
- [ ] 移除 default_server
- [ ] 取消註解 include snippets/security-headers.conf;
- [ ] 改 root folder (記得要在最後面加 **public**)
- [ ] 改 index
- [ ] 改 server_name
- [ ] 改 location / block 中為 `try_files $uri $uri/ /index.php?$query_string;`
- [ ] php block 部分保留 `include snippets/fastcgi-php.conf;` 與 `fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;`
- [ ] 修改專案目錄權限 `sudo chown -R www-data:www-data {專案目錄}`
`sudo chmod -R 775 {專案目錄}`

###### tags: `Nginx`