Articles of nginx

正则expression式位置块在NGINX中不起作用

我有一个非常简单的位置块在我的nginx conf中,看起来像这样: location ~* ^\/[a-z0-9]{24}$ { // do some things } 我试图捕捉以Mongo ObjectId结尾的url。 例如: https : //example.com/5550cdea6928495a25bb8df8 出于某种原因,nginx告诉我有一个错误: 2016/01/07 22:36:32 [emerg] 26445#0: unknown directive "24}$" in /etc/nginx/sites-enabled/mysite.com:32

在nginx上设置CORS标题

地址如http://vpsxxx.ovh.net/g/search?q=ok或http://vpsxxx.ovh.net/so/questions/34738694/how-to-move-items-on-the-screen-for-a-game-using-javascript当从浏览器url栏中尝试它们时, http://vpsxxx.ovh.net/so/questions/34738694/how-to-move-items-on-the-screen-for-a-game-using-javascript是很好代理的 但不是从JS,甚至在添加CORS头后,例如: http : //jsfiddle.net/crl/svmw93a8/1/,http : //jsfiddle.net/crl/svmw93a8/2/ 甚至一个请求的根/像: ajax('http://vpsxxx.ovh.net').then(function(r){ console.log(r) }); 不工作 这里是conf文件: server { listen 80; server_name vpsxxx.ovh.net; # some ovh server location /g/ { proxy_pass http://www.google.com/; } location /so/ { proxy_pass http://stackoverflow.com/; } location / { # I tried putting it before other locations too proxy_pass http://www.google.com/; # added here also, for […]

在Varnish之前的Nginx有时会产生“从上游读取响应头时出现上游过早closures连接”的错误

我在同一台服务器上的Varnish(4.1.0)前面有Nginx(1.9.9)。 //nginx upstream varnish { server 127.0.0.1:8391; keepalive 16; } location ~ \.php$ { proxy_pass http://varnish; proxy_http_version 1.1; #for 1.0 varnish shows blank page proxy_set_header Connection ""; proxy_redirect off; proxy_set_header Host $host:$server_port; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 600; proxy_send_timeout 600; proxy_connect_timeout 600; } //varnish DAEMON_OPTS="-a :8391 \ -T localhost:6082 \ -f /etc/varnish/default.vcl \ […]

redirect一切,但在NGINX(让我们encryption)

我想通过letsencrypt.sh获得一个证书,所以我必须提供一个对HTTP的挑战。 我已经使用NGINX转发到SSL(服务于一个nodejs服务器)。 现在我想把所有东西都redirect到SSL,但不是挑战。 这是我的configuration server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; server_name screen.example.com; location /.well-known { return; } location / { return 301 https://$server_name$request_uri; } } 打开挑战URL仍然会将我redirect到HTTPS。 我怎样才能解决这个问题?

Nginx – SSL正向保密和iOS9支持

我正在尝试将几个Linux Web服务器与当前的SSLbuild议结合起来,特别是允许iOS9连接。 一个服务器是CentOS 7,另一个是CentOS 6.4。 我现在已经configuration好了CentOS 7机器,在ssllabs.com上有一个很好的绿色A. 然而,在CentOS 6.4盒子(使用相同的ssl_protocols,ssl_ciphers和ssl_dhparm),我得到一个A-的消息“服务器不支持参考浏览器的前向保密”。 在ssllabs报告的握手模拟部分,Apple ATS 9 / iOS 9正在失败。 ssllabs列出了iOS9的UAfunction: TLS_EMPTY_RENEGOTIATION_INFO_SCSV (0xff) – TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (0xc02c) Forward Secrecy 256 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (0xc02b) Forward Secrecy 128 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 (0xc024) Forward Secrecy 256 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (0xc00a) Forward Secrecy 256 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 (0xc023) Forward Secrecy 128 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA (0xc009) Forward Secrecy 128 TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (0xc030) Forward Secrecy 256 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 […]

在Ansible上转发Kerberos身份validation

我有一个可控的控制机器(host-A),需要与host-C(一个没有本地用户的Windows机器(这是一个Active Directory))交谈。 主机-A对主机C没有networking访问权限,但可以使用主机-B进行通信。 主机-B它是一个Linux机器。 host-A通过ssh访问主机B. 本文后面我创build了一个nginx服务器来在主机B上路由WinRMstream量 server { listen 5986 default ssl; server_name localhost; ssl_certificate ssl/nginx.crt; ssl_certificate_key ssl/nginx.key; location /host-c { proxy_pass https://host-c-address:5986/wsman; } } 我的主机C的库存清单就像: [windows] host-c ansible_host=host-b ansible_winrm_path=host-c 而windows的group_vars是: ansible_user: myuser ansible_pass: andmypass ansible_port: 5986 ansible_connection: winrm ansible_winrm_realm: HOSTCDOMAIN.LOCAL ansible_winrm_scheme: https ansible_winrm_transport: kerberos ansible_winrm_server_cert_validation: ignore 我迄今testing的东西 1testing没有Kerberos 改变了这一行: ansible_winrm_transport: ssl 这是不可能的,因为host-c不能拥有本地用户。 fatal: [host-c]: […]

在使用前检查Apache / Nginx上的HTTPS设置

您刚刚获得了新的HTTPS(SSL / TLS)证书,您希望获得正确的中间证书。 这是在Apache中设置的: SSLCertificateKeyFile /etc/ssl/www.example.com.key SSLCertificateChainFile /etc/ssl/www.example.com.chn SSLCertificateFile /etc/ssl/www.example.com.crt 或者在Nginx中用: ssl_certificate_key /etc/apache2/ssl/www.example.com.key; ssl_certificate /etc/apache2/ssl/www.example.com.pem; 记住apachectl configtest只检查这些文件是否存在; 和nginx -t “将失败,如果网站证书不是第一个在crt文件中,并且如果密钥错误”(感谢Drifter104 )。 那么,在重新启动之前如何检查一切? 可能的问题 您有错误的中间体(例如, GeoTrust在一个页面上列出了所有的中间体 )。 您不小心混合了中级证书文件和您的网站证书文件。 你包括根证书(影响性能,因为这发送不必要的数据)。 您缺less一个或多个中间证书。 证书是错误的密钥。 您已经将这些文件留在服务器上的任何人可读(如chmod 644 )。 您正在使用错误的证书(域不在CN或SAN中 ) 一些起点 提取有关密钥,CSR或证书文件的信息: openssl rsa -check -in "www.example.com.key"; openssl req -text -noout -verify -in "www.example.com.csr"; openssl x509 -text -noout -in "www.example.com.crt"; […]

Nginxlogin到TCP端口上的syslog

我需要将Nginx访问和错误日​​志redirect到远程系统日志服务器。 从http://nginx.org/en/docs/syslog.html我看到我可以这样做: error_log syslog:server=192.168.1.1; 不过,我需要redirect到一个特定的TCP(而不是UDP!)端口,我试着: error_log syslog:server=192.168.1.1:3000; 但是没有通过。 如何指定Nginx的端口应该是TCP而不是UDP? 非常感谢!

client_body_buffer_size威胁

在我目前的nginxconfiguration中,我得到了: client_max_body_size 100M; client_body_buffer_size 1M; client_max_body_size我需要设置得这么大。 不幸的是,我经常在ppl上传文件时得到通知。 [warn] 790#0: *112386 a client request body is buffered to a temporary file 正如我在网上find – 提高“client_body_buffer_size”configuration值将有所帮助。 但首先我想知道它会带来什么样的威胁。 DOS攻击会更容易? Nginx将需要更多的空间来处理所有请求? 别的东西?

Haproxy和nginx rtmp

我正在尝试在rtmp nginx服务器前使用haproxy 它连接,但它不播放video我有2台服务器1台服务器是rtmp nginx安装和第二台服务器,其中haproxy安装 这是haproxyconfiguration listen rtmp :1935 mode tcp balance roundrobin server s1 rtmp_server_ip:1935 check 我也尝试设置1936年 这是它应该如何工作 web >> haproxy >> nginx rtmp 这是nginx rtmpconfiguration rtmp { server { listen 1935; listen 1936 proxy_protocol; notify_method get; on_play http://127.0.0.1/vod_handler; application vod { play /path_to_videos/uploads/; } } }