您的位置:首页 > 理论基础 > 计算机网络

ECshop安装GET http://192.168.1.105/ecshop/install/styles/general.css net::ERR_ABORTED错误的解决

2018-04-01 11:14 716 查看


      如图,将ECshop的代码发送到服务器上之后,配置好ngin.conf配置文件PHP的路径之后,然后在客户机上输入ECshop的地址,发觉报错如上图所示。根据错误提示信息可知,是缺少文件所致,但是回到服务器中,发觉提示找不到的文件确实存在。在网上找了很多资料,也没有解决,因为环境不一样。
      最后忽然想到,文件找不到,那么NGINX的日志文件肯定有错误日志信息,然后就去查看error.log日志文件,发觉其中有如下错误信息:2018/04/01 10:18:15 [error] 7744#0: *3049 open() "/usr/local/nginx/html/ecshop/install/images/loading.gif" failed
(2: No such file or directory), client: 192.168.1.106, server: localhost, request: "GET /ecshop/install/images/loading.gif
HTTP/1.1", host: "192.168.1.105", referrer: "http://192.168.1.105/ecshop/install/index.php?lang=zh_cn&step=welcome"    看到‘2018/04/01 10:18:15 [error] 7744#0: *3049 open() "/usr/local/nginx/html/ecshop/install/images/loading.gif" failed ’一行,顿时豁然开朗,这是因为没有在nginx.conf配置文件中指定gif等文件的路径信息,因此浏览器在请求这些信息时,访问的是NGINX的默认的存放GIF的路径,在nginx.conf文件中指定gif文件的存储路径即可。
nginx的配置文件修改如下:
//开启nginx日志输出功能
error_log logs/error.log;
error_log logs/error.log notice;
error_log logs/error.log info;
#开启nginx的日志功能,初学者肯定不知道这个功能的强大之处,以后只要出错,这个文件一般能大大节约排错时间

//HTML文件的存储位置
location ~* \.(html|htm)$ {
root /dirname/www;
index index.php index.html index.htm;
}

//git等文件的存储位置
location ~ /.*.(js|css|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|
root /dirname/www/;
expires 1d;
}

//PHP文件的存储位置
location ~* \.php$ {
root /dirname/www/;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}     这样,浏览器访问服务器上的资源,服务器就可以正确的找到文件路径,不会再出现404 not found的错误了。后期会更新讲解lnmp环境搭建的详细配置过程,敬请期待。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐