我的应用程序(比如说/members )上的一些SQL负载URL正在受到僵尸networking的攻击。 所以我想禁用任何人张贴到这些url,同时允许他人获得他们。 我试图做一个这样的嵌套循环: if ($request_uri ~ .*members^) { if ($request_method = POST ) { return 444; } } 但是nginx不接受这个。 我也试过这个指令 location ~ "^/members$" { if ($request_method ~ ^(POST)$ ) { return 444; } } 但是这个也拒绝GET。 所以一无所知,感谢你的帮助。
目前,我们有一个服务器,实现302redirect到服务器的一些内容。 例如,用户请求: http://origin1.example.com/m3ugen/segsrc/jet480.mp4 而这个服务器用302响应并服务于: http://origin1.example.com/Segments/HLS_TS/segsrc/jet480.mp4-20140831-142558.m3u8` 这对我们来说是有问题的,我们希望让Nginx处理这个更友好的用户,并与一些不处理302redirect的玩家合作。 我们想要的是: 用户请求http://frontend.example.com/hls/jet480.mp4.m3u8并由nginx接收。 Nginx请求http://origin1.example.com/m3ugen/segsrc/jet480.mp4 Nginx接收redirect代码302 http://origin1.example.com/Segments/HLS_TS/segsrc/jet480.mp4-20140831-142558.m3u8 Nginx向http://origin1.example.com/Segments/HLS_TS/segsrc/jet480.mp4-20140831-142558.m3u8发出请求,并直接向用户提供响应,而不进行任何302redirect。 我认为这可以用Nginx来完成,但我们对此没有太多的经验。 任何帮助将非常感激。 PD我们不能configuration原始服务器。 它使用Helix服务器,当为m3u8播放列表提供服务时,它会为每个文件添加一个时间戳。
我有一个基本的网站运行在一个域名(例如example.com),我想在一个子目录(例如:example.com/test)中运行烧瓶应用程序烧瓶应用程序运行在端口5433使用默认烧瓶开发服务器。 我使用下面的nginxconfiguration来实现这一点 location /test { rewrite /test(.*) $1 break; proxy_pass http://localhost:5433; proxy_redirect default; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location /static/{ alias /home/hrishi/www/example.com/test/app/static/; } 我能够使用example.com/test/ url访问应用程序,但是静态文件无法加载(出现404错误),尽pipe有别名。 我怎样才能解决这个问题? 更新:按照指示添加整个服务器块 server { listen *:80 default_server; ## listen for ipv4; this line is default and implied #listen [::]:80; # listen for ipv6 root /home/hrishi/www/example.com/; […]
我无法在新的DigitalOcean液滴上运行我的应用程序。 机器运行CentOS 6.5 我的/etc/nginx/nginx.conf user nginx www-data; worker_processes 1; error_log /var/log/nginx/error.log; #error_log /var/log/nginx/error.log notice; #error_log /var/log/nginx/error.log info; pid /var/run/nginx.pid; (continues) 我的myapp_nginx.conf server { server_name 104.xxx.x.xxx; listen 8080; charset utf-8; client_max_body_size 30M; location / { index index.html index.htm; root /home/webdev/mydevelopment/git/ers_portal; try_files $uri @app; } location /static { alias /home/webdev/mydevelopment/git/ers_portal/app/static; } location @app { include uwsgi_params; uwsgi_pass […]
我正在将旧式/category.php?id=4url的网站迁移到/ category / seo-friendly-slugurl。 rewrite ^/category.php?id=1$ /styles-de-bieres-belges/pils permanent; rewrite ^/category.php?id=2$ /styles-de-bieres-belges/bieres-blanches permanent; rewrite ^/category.php?id=4$ /styles-de-bieres-belges/lambics-et-gueuzes permanent; rewrite ^/category.php?id=5$ /styles-de-bieres-belges/ales-stouts-et-ipa permanent; rewrite ^/category.php?id=6$ /styles-de-bieres-belges/bieres-trappistes permanent; rewrite ^/category.php?id=7$ /styles-de-bieres-belges/bieres-d-abbaye permanent; rewrite ^/category.php?id=8$ /styles-de-bieres-belges/bieres-rouges-des-flandres permanent; rewrite ^/category.php?id=9$ /styles-de-bieres-belges/lambics-et-gueuzes permanent; rewrite ^/category.php?id=11$ /styles-de-bieres-belges/bieres-fruitees permanent; rewrite ^/category.php$ /styles-de-bieres-belges permanent; 但所有'/category.php?id=…'请求都会redirect到/styles-de-bieres-belges (最后一行)。 如果我删除这最后一行,它根本不redirect。 这个设置有什么问题?
我们有一个QA版本,一个UAT版本和一个DEV版本的webapp。 用户需要通过http://uat.company.com:41002/webapp和http://dev.company.com:41002/webapp进入。 在端口41001上还有一个不同的webapp,他们也需要访问端口8080。 这些url需要在公司外部可用,我们只有一个公共IP地址可以访问。 因为这样的DNSlogging需要全部3个地址来指向一个IP。 在单个IP地址上,服务器驻留在运行nginx。 在后台我需要每个url指向一个不同的服务器 http://uat.company.com –> 123.123.123.1 http://qa.company.com –> 123.123.123.2 http://dev.company.com –> 123.123.123.3 恐怕我不知道正确的术语,但是URI和端口的其余部分也必须结转到IP地址。 即如果有人访问 http://uat.company.com:41002/webapp/somepage` 它会看起来好像是他们访问的页面,但他们真的会看 http://123.123.123.1:41002/webapp/somepage 或者如果他们访问 http://qa.company.com:8080/static/home.html 他们真的会在看 http://123.123.123.2:8080/static/home.html 但他们的浏览器仍然会说http://qa.company.com:8080/static/home.html 我努力了 server { server_name uat.company.com; listen 41001; listen 41002; listen 8080; location / { proxy_pass http://123.123.123.1:$server_port$uri; proxy_set_header Host $host; } } 但是,这给了我一个坏的网关502页与日志: 2015/01/28 16:04:49 [crit] 30571#0: *1 connect() to […]
我在FreeBSD上有Nginx的网站服务器。 上周我们决定放弃对我们网站的SSLv3连接的支持。 不过,我想知道如果nginx有所有不能成功执行SSL握手的客户端的日志。 如果我们有一些关于仍然使用SSLv3连接的IP地址的数据,那将是非常好的。 我试图查看nginx错误日志。 这就是我只能find小日志的地方 2015/03/18 16:55:32 [error] 48792#0: accept4() failed (53: Software caused connection abort) 2015/03/19 19:47:05 [error] 48791#0: accept4() failed (53: Software caused connection abort) 2015/03/19 23:39:54 [error] 48791#0: OCSP_check_validity() failed (SSL: error:2707307D:OCSP routines:OCSP_check_validity:status expired) while requesting certificate status, responder: ocsp2.globalsign.com 没有提到由于SSLv3握手失败而中止的客户端。 nginx能configuration成logging这种错误吗?
我们试图让HAProxy侦听来自端口443(HTTPS&WSS)的所有传入stream量, 以下是我们的HAProxyconfiguration: frontend wwws bind 0.0.0.0:443 ssl crt /etc/haproxy/server.pem timeout client 1h default_backend www_backend backend www_backend mode http stats enable stats uri /haproxy option forwardfor reqadd x-forwarded-proto:\ https server server1 backend:3000 weight 1 maxconn 8192 check 0.0.0.0:443(例如https://example.com )是我们的HA代理服务器监听所有传入的后端stream量:3000是我们的nginx服务器,它被设置为监听SSL连接 目前我们面临的问题是当我们inputhttps://example.com时 ,浏览器显示以下错误: 400 Bad Request The plain HTTP request was sent to HTTPS port nginx/1.7.5 这似乎是当haproxy转发stream量到nginx(后端:3000)它转换为http。 我认为“reqadd […]
我有一个使用nginx的私人HTTPS服务器。 因此,我不在乎浏览器的兼容性,也不在乎HTTPS的redirect。 我只是希望它在我的环境和其他地方工作。 我已经configuration了“listen 17648 ssl;”。 每当我尝试使用普通的HTTP连接到它,我得到臭名昭着的“简单的HTTP请求被发送到HTTPS端口”的回应。 当HTTP请求发送到HTTPS端口时,有没有办法阻止nginx发送任何响应? 我希望nginx简单地closures连接,如果请求不是SSL,或者可能返回一些SSL级别的错误,但根本没有普通的HTTP响应,甚至没有错误响应。
我想达到以下结果: 对任何位置,文件,path应用基本身份validation 删除IP / CIDR范围白名单的基本身份validation 除了一个IP地址(包括上面的内容)之外,阻止所有对特定目录的访问,以及其下的所有访问。 这是我使用的nginxconfiguration: server { listen 80 default; # Basic auth auth_basic "Restricted"; auth_basic_user_file /etc/nginx/.htpasswd; satisfy any; # IP whitelist include /etc/nginx/conf.d/ip-whitelist.conf.include; deny all; # Lock down the "hello" directory to specific IP addresses location /hello/ { # Developers only – ever! allow 12.34.56.78; deny all; } # … } 目前发生的情况是,上面的项目符号列表中的第一点和第二点都在起作用 […]