我想在Nginx后面运行datastax cassandra opscenter。 但它不断添加opscenter端口(默认8888)到所有的URL。 有没有configuration设置来禁用或什么? 这里是我的超级简单的nginxconfiguration: server { server_name opscenter.hostname.com; location / { proxy_pass http://127.0.0.1:8888; } } 有什么我可能做错了吗?
我需要两套不同的上游。 但是我所有的请求都来自同一个URL(相同的path)。 不同的是,一些请求会有一个特殊的说法,有些则不会。 根据这一点,我需要select使用哪个上游。 这是我的configuration文件的一个例子不完整的部分: server_name localhost; root /var/www/something/; upstream pool1 { server localhost:5001; server localhost:5002; server localhost:5003; } upstream pool2 { server localhost:6001; server localhost:6002; server localhost:6003; } location / { # this is the part where I need help try_files $uri @pool1; } location @pool1 { include fastcgi_params; fastcgi_pass pool1; } location @pool2 […]
我在/img/有一个图像目录。 当对该目录中不存在的图像提出请求时,我想提供/img/default.jpg 。 我将如何添加到我的nginxconfiguration?
我在nginx后面的apache服务器上有一个批量search表单。 我希望保护该位置,以便在10分钟内获得301的“第二个请求”,而不是像下面这样使用我们的API: http { limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; server { location = /search/bulk { limit_req zone=one burst=2; … SOME CONFIG HERE… } } } 当他们打我的limit_req,而不是显示一个ngnix错误页面时,我将如何301最终客户端? 另外,其次,我不想限制整个http子句的stream量。 我可以在没有费率的情况下设置一个limit_req_zone,但在我的位置节中有吗? 谢谢, M.
我怎样才能启用特定url的nginx catch? 我有一个Django的Web应用程序,我把我的静态文件,如CSS,JavaScript和…在一个名为静态文件夹,我可以访问他们通过http://example.com/static/ ,我想configurationNginx N顺序只能从这个url捕获这些文件。 我读过http://www.nginxtips.com/how-to-enable-browser-cache-static-files-on-nginx/,但是这个选项没有在那里解释。 我试着下面的configuration,并重新启动我的ngnix服务器,但我有错误。 这是我的sites-available/defaultconfiguration文件。 有什么问题? server { listen 80; listen 443 ssl; server_name www.example.com example.com; ssl_certificate /var/www/example/ssl/ssl.crt; ssl_certificate_key /var/www/example/ssl/ssl.key; location /static (jpg|jpeg|png|gif|ico|css|js)$ { alias /var/www/example/static; expires 3d; add_header Pragma public; add_header Cache-Control "public, must-revalidate, proxy-revalidate"; } location /media { alias /var/www/example/media; } location / { proxy_pass http://127.0.0.1:8000; } } 这是nginx日志文件内容… 2014/03/07 […]
是否有可能从Nginx的access.log中排除某些IP地址,例如,有很多请求来自监控服务器?
我有Nginx运行PHP和WordPress。 Acunetixbuild议设置这些标志,但它们不提供任何文档。 我已经看了一下,但是我没有看到任何显示如何实现这个的东西。 我有这个模块:Nginx的http://wiki.nginx.org/HttpHeadersMoreModule ,如果这将有所帮助。 任何有关如何设置这些标志的信息? 谢谢。 按照这里要求的cookie样本 Cookie:__cfduid = d3-shortened-08; cf_use_ob = 0; wordpress_logged_in_6dfda缩短的-e3e82d5; __utma = 21-缩短-436.19; __utmc = 21519150; __utmz = 2119150.1396063475.3.2.utmcsr =谷歌| utmccn =(有机)| utmcmd =有机| utmct R =(未%20provided); testing= 1; SID = A14-缩短-384; sessiontest = 1; WP-设置-2 =编辑%3Dhtml%26wplink%3D0%26uploader%3D1%26mfold%3DO%26ed_size%3D 677%26libraryContent%3Dbrowse%26urlbutton%3Dfile; WP-设置时间-2 = 139745167; wordpress_test_cookie = WP +曲奇+检查; wordpress_logged_in_a9缩短的-d2a7 = DrDinosaur%7C1397980-缩短-2F9
是否可以在一个位置块中设置超时指令,以防止nginx从长时间运行的PHP脚本(PHP-FPM)返回504? server { listen 80; server_name ubuntu-vm.test-api; root /home/me/Sites/path/to/site/; index index.php; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { try_files $uri =404; # Fix for server variables that behave differently under nginx/php-fpm than typically expected fastcgi_split_path_info ^(.+\.php)(/.+)$; # Include the standard fastcgi_params file included with nginx include fastcgi_params; fastcgi_param PATH_INFO $fastcgi_path_info; […]
是的,但是,根据ngnx文档“ configurationHTTPS服务器 ”(“单个HTTPS服务器”部分), 这个问题与此问题是重复的,这个限制已经不复存在,对这个问题的答案不再有效。 从上面的链接: 在0.7.14之前,不能有select地启用SSL,如上所示。 SSL只能在使用ssl指令的整个服务器上启用,因此无法设置单个HTTP / HTTPS服务器。 listen指令的ssl参数被添加来解决这个问题。 在现代版本中使用ssl指令是不鼓励的。 但是,在该文档中规定的服务器块设置: server { listen *:80; listen 443 ssl; server_name example.com *.example.com; […] …当对https://example.net发出请求时,nginx仍然会从example.com提供内容。 我知道SSL是在HTTP请求之前提供的,但是必须有某种方法来阻止服务器响应没有与其关联的有效SSL证书的SSL请求。 任何有关这方面的见解,非常感谢。
我创build了一个目录来存储PHP 5 FPM的套接字文件: sudo mkdir /var/run/php-fpm 。 它由root:root以及核心PHP FPM进程拥有。 当PHP FPM启动时,它为该目录内的每个池创build套接字文件,并且nginx使用它们进行通信。 但是,当我重新启动我的机器( sudo reboot )后,此目录在重新启动后不见了,PHP FPM无法启动,导致它无法在丢失的目录中创build套接字文件。 可能是什么问题? 我如何debugging它? 我正在使用最新的Ubuntu Server 14.04。