网上的方法大部分都靠谱php
出现这个缘由 是由于路径不对,没有解析对应路径下的php文件css
只要你的配置都正常通常不会出现这个问题nginx
下面是个人nginx配置文件,以edusoho配置举例web
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 安全
后来改了用户权限就行了app
把项目目录改成:网站
chown -R www:www ./*spa