我们的应用程序是在Nginx / 1.14.0和Centos 7上的Code Igniter 3 + PHP 7中开发的,并且config.php文件的详细信息如下
$config['base_url'] = 'http://myurl.com/';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
nginx服务器块如下
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
当我检查nginx access.log文件时,我得到了
"POST /Authentication/login HTTP/1.1" 404 162 "http://myurl.com/"
当我们尝试登录该应用程序时,出现404错误。该站点在Apache上运行良好,但在Nginx中运行不正常。这必须是配置问题。请指教。