forward

Nginx can not forward the request protocol correctly to upstream

对着背影说爱祢 提交于 2019-11-27 02:40:50
问题 I have a website in rails 4 beta. It is running on Nginx + Unicorn. I want nginx to forward the request protocol ( 'http' or 'https' ) to unicorn so that I can work with them. However I am not able to make it work. I put <%= request.ssl? %> and <%= request.protocol %> in the view file for testing. My nginx server config file is as following: upstream unicorn { server unix:/tmp/unicorn.blog.sock fail_timeout=0; } server { listen 80; listen 443; server_name example.com; root /home/example; ssl

Why do two programs have forward referencing errors while the third does not?

旧城冷巷雨未停 提交于 2019-11-27 02:01:49
问题 The following does not compile, giving an 'illegal forward reference' message: class StaticInitialisation { static { System.out.println("Test string is: " + testString); } private static String testString; public static void main(String args[]) { new StaticInitialisation(); } } However, the following does compile: class InstanceInitialisation1 { { System.out.println("Test string is: " + this.testString); } private String testString; public static void main(String args[]) { new

【图文教程】防火墙

时光怂恿深爱的人放手 提交于 2019-11-27 00:24:07
防火墙 1. firewalld和netfilter SELINUX介绍 1. 临时关闭:selinux: 2. 查看关闭状态:getenforce 3. 永久关闭 selinux:编辑 /etc/selinux/config 文件,把 SELINUX 行改为 disabled ,然后重启操作系统: 4. 在 CentOS7 上也可以使用 netfilter 机制的防火墙: 5. 首先关闭 CentOS7 上的 firewalld 服务: 6. 如果想启动 netfilter 服务,我们需要安装 iptables-services 包,安装这个包等于开启了 netfilter 服务: 10.13 netfilter5表5链介绍 1. Nat表映射示意图: 2. netfilter 5链示意图: 10.14 iptables语法 iptables介绍: iptables参数示例: 1. 使用 iptables -nvL 命令查看 iptables 服务自带的一些规则: 2. iptables 的默认规则在 /etc/sysconfig/iptables 文件里保存着: 3. 清除规则使用 iptables -F 命令,这样虽然清空了规则,但是默认规则还会保存在 /etc/sysconfig/iptables 文件里: 4. 重启 iptables 规则: 5. 想要把当前规则保存到

Usage of std::forward vs std::move

情到浓时终转凉″ 提交于 2019-11-27 00:05:57
问题 I always read that std::forward is only for use with template parameters. However, I was asking myself why. See the following example: void ImageView::setImage(const Image& image){ _image = image; } void ImageView::setImage(Image&& image){ _image = std::move(image); } Those are two functions which basically do the same; one takes an l-value reference, the other an r-value reference. Now, I thought since std::forward is supposed to return an l-value reference if the argument is an l-value

How to capture browser's back/forward button click event or hash change event in javascript?

自古美人都是妖i 提交于 2019-11-26 20:59:02
问题 I want to alert() when browser's back or forward button is clicked or hash is changed in javascript. I have tried this solution and it is working but it is causing problems on other links in webpage and submit each request twice on any link click event. Is there any solution to capture it without using setInterval() function? So I need to capture hash change or back/forward button click event? I need a simple javascript code/function/property that should work in all modern browsers. Any

软件防火墙之iptables/netfilter概念篇(一)

扶醉桌前 提交于 2019-11-26 20:22:10
目录 简介 防火墙分类及说明 netfilter钩子 iptables中的表 chains 表链关系 iptables中的规则 Matching targets 简介 在讲防火墙的时候,不得不说的是iptables,本文尽量以通俗易懂的方式描述iptables的相关概念,请耐心的读完。 防火墙分类及说明 从逻辑上讲防火墙分为主机防火墙和网络防火墙两类。 主机防火墙: 针对单个主机进行防护; 网络防火墙:往往处于网络入口或边缘,针对于网络入口进行防护,服务于防火墙背后的本地局域网。 网络防火墙和主机防火墙并不冲突,可以理解为,网络防火墙是对一个集体的防范,主机防火墙则是对个人的防范。 从物理上讲,防火墙可以分为硬件防火墙和软件防火墙。 硬件防火墙:在硬件级别实现部分防火墙功能,另一部分功能基于软件实现,性能高,成本高。 软件防火墙:应用软件处理逻辑运行于通用硬件平台之上的防火墙,性能低,成本低。 接下来我们来聊老linux的iptables。 什么是netfilter和iptables 简单点的来说: netfilter指整个项目,不然官网就不会叫www.netfilter.org了。 netfilter特指内核中的netfilter框架,iptables指用户空间的配置工具。 netfilter在协议栈中添加了5个钩子,允许内核模块在这些钩子的地方注册回调函数

15、iptables详解

最后都变了- 提交于 2019-11-26 19:38:46
-- http://www.netfilter.org/ http://www.iptables.org/ --参考路径 http://www.netfilter.org/documentation/index.html#documentation-howto 1,包过滤防火墙 在网络层对数据包进行选择,主要是对数据包的所使用的协议,端口,源地址和目标地址等参数来进行过滤 2,代理网关 squid(代理网关,反向代理web加速) varnish nginx haproxy --后面这几个软件也可以去做反向代理(但不做代理网关) 把内网和外网是完全隔离的,内网和外网不能进行直接的 TCP通讯,必须通过代理网关的处理 .exe .jpg 3,状态检测 TCP有三次握手的阶段,常用的WEB,文件下载,发送和接收邮件等等都是TCP 状态检测防火墙除了包过滤防火墙所考查的参数之外,还要关心数据包连接的状态 可以做安全控制的: tcpwrapper pam 可植入性安全模块 selinux security enhanced linux (在rwx权限之外,进程访问文件或目录加的额外权限) 完整性检测 tripwire 入测检测 snort SSL/TLS 网络传输加密通讯 ip tunnel + ipsec 网络传输加密通讯 netfilter / iptables --iptables

Private Methods in Objective-C, in Xcode 4.3 I no longer need to declare them in my implementation file ?

旧巷老猫 提交于 2019-11-26 18:50:59
I have a lot question marks tolling above my head. What I don't get is before xcode 4.3 I needed to declare forward declarations (for private methods) in my implementation file. Like in my .m file: // deleting this with xcode 4.3 the below code still does work // in previous versions i had to put this because otherwise the compiler can't find methodFirst @interface DetailViewController () - (void)methodFirst; - (void)methodSecond; @end @implementation DetailViewController - (void) methodSecond { // if i delete the forward declaration now adays i dont get a compiler error that he cant find

两个撩妹的python项目

℡╲_俬逩灬. 提交于 2019-11-26 17:45:13
这两天刷爆朋友圈的莫过于一则「啥是佩奇」的视频短片,看完之后不由的感叹一句,好久没见过这么温情幽默的广告了! 作为一个python的学习者,让我萌生了用python画社会人的想法。 看这个图像可以发现,佩奇由各种曲线、类抛物线、类圆、类椭圆等组成。这里提到的“类”,是小猪佩奇的构图精髓,一种手绘风格,而不是标准刻板的线条。 思路如下:选好画板大小,设置好画笔颜色,粗细,定位好位置,依次画鼻子,头、耳朵,眼睛,腮,嘴,身体,手脚,尾巴。 环境 语言:python3.7 编辑器:Pycharm 具体代码如下: from turtle import * def nose(x,y):#鼻子 penup()#提起笔 goto(x,y)#定位 pendown()#落笔,开始画 setheading(-30)#将乌龟的方向设置为to_angle/为数字(0-东、90-北、180-西、270-南) begin_fill()#准备开始填充图形 a=0.4 for i in range(120): if 0<=i<30 or 60<=i<90: a=a+0.08 left(3) #向左转3度 forward(a) #向前走a的步长 else: a=a-0.08 left(3) forward(a) end_fill()#填充完成 penup() setheading(90) forward(25)

Private Methods in Objective-C, in Xcode 4.3 I no longer need to declare them in my implementation file ?

坚强是说给别人听的谎言 提交于 2019-11-26 17:26:37
问题 I have a lot question marks tolling above my head. What I don't get is before xcode 4.3 I needed to declare forward declarations (for private methods) in my implementation file. Like in my .m file: // deleting this with xcode 4.3 the below code still does work // in previous versions i had to put this because otherwise the compiler can't find methodFirst @interface DetailViewController () - (void)methodFirst; - (void)methodSecond; @end @implementation DetailViewController - (void)