> 主要是為了用Nginx運行PHP環境
1. Nginx
官方文檔的配置
default.conf?
This configuration enables URLs without “index.php” in them and using CodeIgniter’s “404 - File Not Found” for URLs ending with “.php”.
server {listen 80;listen [::]:80;server_name example.com;root /var/www/example.com/public;index index.php index.html index.htm;location / {try_files $uri $uri/ /index.php$is_args$args;}location ~ \.php$ {include snippets/fastcgi-php.conf;# With php-fpm:fastcgi_pass unix:/run/php/php7.3-fpm.sock;# With php-cgi:# fastcgi_pass 127.0.0.1:9000;}error_page 404 /index.php;# deny access to hidden files such as .htaccesslocation ~ /\. {deny all;} }
配完后出現403
2. php-fpm
這個php-fpm的配置想了想,自己電腦之前應該沒安裝。
這里使用Ubuntu
sudo apt-get install php8.1-fpm
sudo systemctl restart nginx.service
配完后沒有403,跳到了whoop的錯誤頁面
?Whoops! We seem to have hit a snag. Please try again later?
?
3. 關閉whoop調試
?Config/Boot/production.php :
1 |
|
再次刷新看到是writeable沒有權限,權限配好后錯誤消失。