当前位置: 首页 > news >正文

PHP codeigniter4 搭配Nginx

> 主要是为了用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

ini_set('display_errors', '1');

再次刷新看到是writeable没有权限,权限配好后错误消失。

http://www.lryc.cn/news/116932.html

相关文章:

  • AWS——04篇(AWS之Amazon S3(云中可扩展存储)-02——EC2访问S3存储桶)
  • .netcore下grpc概述
  • Address already in use
  • ♥ vue中$set用法详细讲解
  • 岩土工程仪器多通道振弦传感器信号转换器应用于桥梁安全监测
  • 企业权限管理(六)-订单详情
  • 基于Tars高并发IM系统的设计与实现-实战篇5
  • 水溶性Cyanine3 N3叠氮化物Cy3 azide星戈瑞
  • 客户案例 | 永续发展,低代码助力“双碳”战略历史使命
  • [保研/考研机试] KY187 二进制数 北京邮电大学复试上机题 C++实现
  • SpringBoot 热部署
  • BLE蓝牙协议栈分析
  • flutter开发实战-BackdropFilter高斯模糊子Widget控件
  • 嵌入式面试刷题(day3)
  • JVM源码剖析之Java命令行参数全解
  • 抽象工厂模式-java实现
  • 机器学习笔记 - 基于Python发现最佳计算机视觉模型的神经架构搜索技术NAS
  • 机器学习---自编码器
  • vuejs 设计与实现 - 渲染器的设计
  • openCV 图像对象的创建和赋值
  • idea - 刷新 Git 分支数据 / 命令刷新 Git 分支数据
  • 线上电影购票选座H5小程序源码开发
  • QT正则校验
  • ChatGPT“侵入”校园,教学评价体制受冲击,需作出调整
  • 函数的声明和定义
  • 06微服务间的通信方式
  • 研发工程师玩转Kubernetes——local型PV和PVC绑定过程中的状态变化
  • HTTP——十一、Web的攻击技术
  • Python-OpenCV中的图像处理-图像金字塔
  • ArcGIS、ENVI、InVEST、FRAGSTATS技术教程