我的網站現在只能訪問默認控制器home,當我想轉到signin頁面時,它回傳 404 Not Found。
一般我只要配置code block nginx一下就覺得配置正確了,我也重啟了nginx服務也沒問題。
但是網站仍然無法訪問signin沒有index.phpurl 的頁面(https://example.com/index.php?/signin)
這是我的配置:
server {
listen ip:80;
server_name example.com www.example.com;
root /home/admin/web/example.com/public_html;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/example.com.log combined;
access_log /var/log/nginx/domains/example.com.bytes bytes;
error_log /var/log/nginx/domains/example.com.error.log error;
location / {
try_files $uri $uri/ /index.php?$query_string;
location ~* ^. \.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
}
location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
error_page 403 /error/404.html;
error_page 404 /error/404.html;
error_page 500 502 503 504 /error/50x.html;
location /error/ {
alias /home/admin/web/example.com/document_errors/;
}
location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}
location /vstats/ {
alias /home/admin/web/example.com/stats/;
include /home/admin/conf/web/example.com.auth*;
}
include /etc/nginx/conf.d/example.inc*;
include /etc/nginx/conf.d/example.inc*;
include /etc/nginx/conf.d/webmail.inc*;
include /home/admin/conf/web/nginx.example.com.conf*;
}
uj5u.com熱心網友回復:
這是 TSL 問題,我設定$config['base_url']了https它應該是http對不起,我的錯誤
uj5u.com熱心網友回復:
大多數情況下,此錯誤是由檔案夾根目錄中缺少 .htaccess 檔案引起的。所以一定要在根目錄下創建一個.htaccess檔案,添加如下內容
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</filesMatch>
它的作用是重命名 URL 并消除在 URL 上添加 index.php 的需要。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/393495.html
標籤:php 代码点火器 nginx codeigniter-3
