php - 为 hmvc 结构使用 nginx 的 Codeigniter 设置

标签 php codeigniter nginx

任何人都可以为 hmvc 结构完成 Codeigniter 设置和 nginx 吗? 请帮助我,我尝试在 nginx 上设置 codeigniter HMVC 结构。但多次失败。请建议一些配置方法。

我正在使用 php7.0-fpm。

我的nginx配置文件是

server {
listen 80;
root /var/www/html/salsetrack;
index index.html index.htm index.php;
server_name local.sales-track.com;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
index index.html index.php;
  try_files $uri $uri/ @handler;
  expires 30d;
} 

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

location ~ \.php$ {
try_files $uri =404; 
#Include Nginx’s fastcgi configuration
include /etc/nginx/fastcgi.conf;
#Look for the FastCGI Process Manager at this location 
fastcgi_pass unix:/run/php/php7.0-fpm.sock;

include fastcgi_params;
 fastcgi_param PATH_INFO $fastcgi_path_info;
 fastcgi_index index.php;
 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

}

location @handler {
      rewrite / /index.php;
}}

最佳答案

可以引用https://www.nginx.com/resources/wiki/start/topics/recipes/codeigniter/用于 codeigniter 的 nginx 配置。

关于php - 为 hmvc 结构使用 nginx 的 Codeigniter 设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53736280/

相关文章:

php - fatal error : Class 'Swift_smtpTransport' not found in

php - codeigniter如何在函数内的模型页面中回显获取的值

codeigniter - Facebook sdk v5 集成到 codeigniter

ruby-on-rails - 太多重定向 : passenger+nginx SSLRequirement

ssl - 如何使用 https 服务 devpi?

php - 使用 PHP 生成 HTTP 206 内容响应

PHP 关闭 mysqli 与数据库的连接错误

php - 使用 php 和 MySql 处理单引号和双引号插入问题的简单有效方法是什么

sockets - lua nginx 模块中提到的 TCP 套接字是什么?

PHP/MySQL/Jquery - 构建关联数组并使用 JQuery $.each 输出它