网上的方法大部分都靠谱
出现这个原因 是因为路径不对, 没有解析对应路径下的 php 文件
只要你的配置都正常一般不会出现这个问题
下面是我的 nginx 配置文件, 以 edusoho 配置举例
- server {
- listen 80;
- # [改] 网站的域名
- server_name ke.zh******u.com;
- #301 跳转可以在 nginx 中配置
- # 程序的安装路径
- root /mnt/wwwroot/edusoho/web;
- # 日志路径
- access_log /mnt/log/nginx/access_edusoho.log;
- error_log /mnt/log/nginx/error_edusoho.log;
- location / {
- index app.php;
- try_files $uri @rewriteapp;
- }
- location @rewriteapp {
- rewrite ^(.*)$ /app.php?/$1 last;
- }
- location ~ ^/udisk {
- internal;
- root /mnt/wwwroot/edusoho/app/data/;
- }
- location ~ ^/(app|app_dev)\.php(/|$) {
- fastcgi_pass unix:/tmp/php-cgi.sock;
- fastcgi_split_path_info ^(.+\.php)(/.*)\.php$;
- include fastcgi_params;
- fastcgi_param PHP_ADMIN_VALUE "open_basedir=/mnt/wwwroot/edusoho:/tmp/:/proc/";
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- fastcgi_param HTTPS off;
- fastcgi_param HTTP_X-Sendfile-Type X-Accel-Redirect;
- fastcgi_param HTTP_X-Accel-Mapping /udisk=/mnt/wwwroot/edusoho/app/data/udisk;
- fastcgi_buffer_size 128k;
- fastcgi_buffers 8 128k;
- }
- # 配置设置图片格式文件
- location ~* \.(jpg|jpeg|gif|png|ico|swf)$ {
- # 过期时间为 3 年
- expires 3y;
- # 关闭日志记录
- access_log off;
- # 关闭 gzip 压缩, 减少 CPU 消耗, 因为图片的压缩率不高.
- gzip off;
- }
- # 配置 CSS/js 文件
- location ~* \.(css|js)$ {
- access_log off;
- expires 3y;
- }
- # 禁止用户上传目录下所有. php 文件的访问, 提高安全性
- location ~ ^/files/.*\.(php|php5)$ {
- deny all;
- }
- # 以下配置允许运行. php 的程序, 方便于其他第三方系统的集成.
- location ~ \.php$ {
- # [改] 请根据实际 php-fpm 运行的方式修改
- fastcgi_pass unix:/tmp/php-cgi.sock;
- fastcgi_split_path_info ^(.+\.php)(/.*)$;
- include fastcgi_params;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- fastcgi_param HTTPS off;
- }
- }
这个配置文件是没问题的, 但是访问的时候频繁出现 no input file specified
后来改了用户权限就好了
把项目目录改为:
chown -R www:www ./*
来源: http://www.bubuko.com/infodetail-2676398.html