Articles of nginx

让SSL在Django项目上工作

我试图让我的Django网站完全移动到https (目前它只是http )。 networking服务器是nginx(反向代理)和gunicorn。 但是,即使正确安装SSL,打开端口443并调整我的nginx虚拟主机文件,我无法连接到我的网站通过https://example.com ( http://example.com工作正常)。 有人可以指导我如何解决这个问题? 以下是详细信息: 在/etc/iptables/rules.v4 (我使用iptables-persistent软件包)中,我有这个代码片段: # Acceptable TCP traffic -A TCP -p tcp –dport 22 -j ACCEPT -A TCP -p tcp –dport 80 -j ACCEPT -A TCP -p tcp –dport 443 -j ACCEPT 如果我写了sudo netstat -4plunt ,输出显示端口443正在监听: Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 […]

nginx反向代理地址/端口已经在使用

我有一个nginx反向代理,我希望它将stream量转发到多个站点,并在端口443上监听所有这些服务。 我已经看到这样做了几个地方,似乎有一个反向代理设置的正常方式…它监听单个端口,并转发基于URL。 不过,我有一些设置,我认为有点奇怪,因为我有一个网站,通过IIS网站使用NTLMvalidation,因此,我使用nginxstream 这是我目前的configuration文件: /opt/nginx/nginx.conf stream { upstream backend { hash $remote_addr consistent; server mysite.domain.com:80 weight=5; server 192.168.0.5 max_fails=3 fail_timeout=30s; } server { listen 192.168.0.2:443 ssl; ssl_certificate /usr/local/nginx/conf/mycert.crt; ssl_certificate_key /usr/local/nginx/conf/mykey.key; ssl_session_cache shared:SSL:10m; ssl_session_timeout 5m; proxy_connect_timeout 1s; proxy_timeout 3s; proxy_pass backend; } } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen […]

允许Google绕过防火墙Nginx

所以我正在寻找一个系统,实质上返回一个401没有一个特定的cookie每个访问者。 我想这样做,如果访问者/请求者是谷歌,那么它不会返回401。 所以下面是我有的代码,它似乎并没有工作,但我不知道为什么。 基本上,我有检查的cookie,然后检查是否不是通过用户代理谷歌。 如果两者都是真的,那么它将返回401。 可能似乎是谷歌仍然得到一个401,当我通过网站主工具获取我的网站。

Nginx反向代理到Tomcat

我已经在DigitalOcean上安装了Ubuntu 15.10 x64服​​务器来testing几个Java应用程序。 我安装了Nginx 1.9.3和Tomcat8,并使用Nginx作为反向代理,将所有请求转发到端口8080上的Tomcat。 这是事情变得危险的地方。 我在我的tomcat安装上运行了两个应用程序,/ webapp1&/ webapp2。 我想指出subdomain.domain.com到/ webapp1和subdomain2.domain.com到/ webapp2。 在Apache中,这是一个相当简单的使用mod_proxy的事情,但对于Nginx来说,这有点神秘。 到目前为止,这是我在我的网站启用/域文件尝试。 第一轮 server{ server_name subdomain1.domain.com; # ******************SSL configuration ************************ listen 443 ssl default_server; ssl_certificate /etc/nginx/conf/ssl/domain.crt; ssl_certificate_key /etc/nginx/conf/ssl/domain.key; #********************************************************************* #**********Proxy********************** location / { proxy_redirect off; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://subdomain1.domain.com:8080/webapp1/; } 这些请求在我访问https://subdomain1.domain.com时起作用,但是在我的应用程序中引用上下文path的任何链接(例如/ webapp1 /)导致包含两个上下文path(例如https://subdomain1.domain)的url。 com / webapp1 […]

删除.php扩展名的同时在根目录下运行wordpress

我有wordpress安装在域的根目录。 我使用漂亮的链接和快速的cgicaching。 现在我在根目录(eG“/ course /”)中有一个目录,其中包含一些与wordpress无关的.php文件。 我很想访问这些没有.php扩展名的文件。 在另一台服务器上,一切都在根目录中设置,我不使用wordpress它的这些服务器块的补充: location / { try_files $uri $uri.html $uri/ @extensionless-php; } location @extensionless-php { rewrite ^(.*)$ $1.php last; } 我正在努力让它在我的WordPress的服务器上工作。 也许我错过了一些东西,这里是完整的服务器块: server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /var/www/html; index index.php index.html index.htm; client_max_body_size 10M; server_name example.com www.example.com; location ~* "^/something" { rewrite ^ http://example.com/curso-gratis-habitos/$ $1?ref=conlasalud permanent; […]

Zimbra和跨源框架

假设我在https://mail.example.com有一个Zimbra webmail。 我在https://app.example.com也有一个networking应用程序。 在其中一个应用程序的网页上,我试图embeddednetworking邮件: <iframe src="https://mail.example.com"></iframe> 但是,当我去应用程序页面时,我得到以下错误(Firefox): Load denied by X-Frame-Options: https://mail.example.com/ does not permit cross-origin framing 。 如何在Zimbra服务器/ nginx上启用交叉框架(最好只适用于app.example.com)? 或者有可能以其他方式embeddednetworking邮件?

和有什么不同?

multi_accept 如果multi_accept被禁用,工作进程将一次接受一个新的连接。 否则,一个工作进程将一次接受所有的新连接。 accept_mutex 如果启用accept_mutex,则工作进程将轮stream接受新的连接。 否则,所有工作进程都会收到有关新连接的通知,如果新连接的数量较less,某些工作进程可能会浪费系统资源。 文档中的定义非常相似

在NGINX中重写错误的URL到.html

前一段时间,我写了一个错误,Google把它们caching在旧的站点地图中。 这在WMT中产生了大量的404错误,我需要用一个可靠的重写进行清理。 我目前使用地图模块,并单独重写每个产品。 例: /product1html/ /product1.html; 在这里粗体的错误: http:// domain / productname html / 这里的错误是我最初忘了。 在html之前,并在最后有一个/。 我怎样才能重写url为http://domain/productname.html每个url看起来像/productnamehtml/ 。

西里尔文URL的HTTPredirect:这个例子没有被编码的​​URL。 为什么?

根据https://tools.ietf.org/html/rfc5987 ,应使用ISO-8859-1字符编码返回HTTP头字段。 这也适用于用于redirect的位置字段。 然而,看下面的例子,我不知道如何redirect工作,尽pipeURL不编码。 http://goo.gl/m5fDF0 我运行了不同的工具,包括谷歌浏览器开发人员,位置字段绝对是编码,但使用CURL或Screaming Frog等软件返回用西里尔文字符写的位置。 理论上redirect应该在404中解决,但是我得到了200。 任何想法如何这是可能的?

用CORS和http / 2修复nginx中的头文件

我一直在努力我的nginxconfiguration了一段时间,但不知何故,我似乎有我的头混合。 我在ubuntu 14.04上运行了使用nginx 1.9.12的http / 2并获得了稳定的A评分 。 但是,即使我得到了大部分的头部修改,我得到一个F头部安全 。 我想这可能与我复制粘贴的CORSconfiguration有关 。 但我只是看不到。 看到下面我的configuration文件与一些缩进的path和一些删除的错误页面指令,使其更简单。 任何帮助表示赞赏。 # settings # server_tokens off; # http to https redirect # server { listen 80; server_name gel.westpacgroup.com.au; return 301 https://$host$request_uri; } # ssl and http2 config # server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name gel.westpacgroup.com.au; ssl on; […]