背景介绍 因为一些浏览器在访问网站时会默认去请求网站的favicon,但是我的网站(Tengine)上并没有这些icon图片,因此在访问日志里会出现大量的404错误,会触发一些没必要日志告警.我们可以通过配置nginx empty_gif来给请求返回一个1x1,大小为43字节的空白图片来解决这个问题.这个给请求返回一个空白图片的做法经常用在网站统计等需求里. empty_gif模块的官方链接地址:http://nginx.org/en/docs/http/ngx_http_empty_gif_m…
前端做跨域本身就是扯淡的事情.后台人员不配合说什么都是白搭.索性整理了一下心得,(可以直接部署自配置)发不多说上代码: 1 #user nobody; 2 worker_processes 1; 3 4 #error_log logs/error.log; 5 #error_log logs/error.log notice; 6 #error_log logs/error.log info; 7 8 #pid logs/nginx.pid; 9 10 11 events { 12 worker…
nginx 反向代理后台web服务器session path导致的session 失效,特此总结下配置方法: 配置如下: location ^~ /2016tyjf_dev/djwechat { proxy_pass http://192.168.23.108/; proxy_redirect http://192.168.23.108 http://wx.zone139.com/2016tyjf_dev/djwechat/; proxy_set_header Host $http_host;…
server { listen 80; server_name XXXX.funova.net XXX.funova.com; root /opt/newgm; index index.php; location / { try_files $uri /index.php$uri; } location ~ .+\.php($|/) { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^(…
Windows中Nginx配置nginx.conf不生效解决方法 今天在做Nginx项目的时候,要处理一个路径映射问题, location /evaluate/ { proxy_pass http://localhost:8080/evaluate/; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } 在nginx.conf中配置好了路径映射,然后重置nginx之…
Nginx 高级配置--关于favicon.ico 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.浏览器会默认帮咱们访问官网的图标 1>.浏览器访问网站"http://node101.yinzhengjie.org.cn/" 2>.使用curl命令访问 [root@node108.yinzhengjie.org.cn ~]# curl http://node101.yinzhengjie.org.cn/ <!DOCTYPE html> &…
Nginx上开启https,  后端使用Tomcat,  两者间走http协议, 但发现如果tomcat应用存在跳转时, 则客户端浏览器会出现400 Bad Request的错误, 通过抓包发现原因是302跳转响应的Location头中的URL是http协议的,  在tomcat的端号采用非标准80端口时会导致客户端出现400.  解决方案是修改nginx.conf, 让nginx将302跳转响应能智能的修改location头域的内容,  即添加以下一行到配置中的server段 问题:浏览器打开…
什么是404页面如果网站出了问题,或者用户试图访问一个并不存在的页面时,此时服务器会返回代码为404的错误信息,此时对应页面就是404页面.404页面的默认内容和具体的服务器有关.如果后台用的是NGINX服务器,那么404页面的内容则可能为:404 Not Foundnginx/0.8.6 为什么要自定义404页面在访问时遇到上面这样的404错误页面,我想99%(未经调查,估计数据)的用户会把页面关掉,用户就这样悄悄的流失了.如果此时能有一个漂亮的页 面能够引导用户去他想去的地方必然可以留住用户…
说明: 内容全部来自 SegmentFault Developer Nginx 配置跨域请求 跨域请求失败, nginx 报错: 403 No 'Access-Control-Allow-Origin' header is present on the requested resource nginx 配置 比如请求的接口是: http://www.test.com/exchangeApi/xxxx server { listen 80; server_name test.com www.tes…
For reference, I am attaching my location block for catching files with the .php extension: location ~ \.php$ { include /path/to/fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root/$fastc…