我有一个在AWS的多容器设置。 我试图按照这个: http : //docs.aws.amazon.com/elasticbeanstalk/latest/dg/health-enhanced-serverlogs.html 然而(尽量使用最新的Nginx – 1.9.12),只要我尝试在文件名中使用variables,我就会在错误日志中看到错误,并且不会创build文件本身。 error.log中: 2016/03/10 05:57:38 [error] 6#6: *1 testing "/etc/nginx/html" existence failed (2: No such file or directory) while logging request, client: xxx.xxx.xxx.xxx, server: localhost, request: "GET /v1/service?staus=ok HTTP/1.1", upstream: "http://xxx.xxx.xxx.xxx:8088/v1/service?staus=ok", host: "xxx.xxx.xxx.xxx" 此configuration不起作用: upstream app_v1 { server app_v1:8088; } map $http_upgrade $connection_upgrade { default "upgrade"; "" ""; } […]
我在nginx后面有一个应用程序。 但我需要在这个应用程序redirect到一个WordPress博客的具体path 例如: example.com/ ——->redirect到我的应用程序 example.com/whatever/ ——->也redirect到我的应用程序 example.com/blog/ ——->redirect到我的WordPress的博客 所以,我添加了一个匹配这个子path的位置 server { listen 80 default_server; index index.php; server_name _; location ^~ /blog { root /path/to/my/blog; index index.php index.html; location ^~ /blog/(.*\.php)$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /path/to/my/blog/$fastcgi_script_name; include fastcgi_params; } } location ~* /(.*) { #here the conf for the rest of the […]
我有一个上游服务器处理我们的网站login。 在成功login时,我想将用户redirect到网站的安全部分。 在login失败时,我想将用户redirect到login表单。 上游服务器在成功login时返回200 OK ,在失败login时返回401 Unauthorized 。 这是我的configuration的相关部分: { error_page 401 = @error401 location @error401 { return 302 /login.html # this page holds the login form } location = /login { # this is the POST target of the login form proxy_pass http://localhost:8080; proxy_intercept_errors on; return 302 /secure/; # without this line, failures work. […]
我的这方面的知识:我觉得OBS软件非常有能力,但是完全不知道我在NGINX上做了什么。 我在做什么:允许不在本地networking上的电脑连接到NGINX rtmp服务器(不知道如果我使用正确的术语,因为我不知道我在做什么)。 然后,我使用rtmp链接作为OBS中的videostream源。 我得到了多less:我已经将RTMP链接添加到OBS作为video源,没有问题。 我设法使用运行NGINX的机器的本地IP地址连接到RTMP链路,但是当使用同一台计算机的公网IP尝试这样做时,它连接失败。 所以我在同一个networking上testing了两台电脑。 我是否正确,我的朋友需要使用该机器的公共IP地址连接到rtmp链接? 如果是这样,我可以做些什么来允许外部连接?
我有nginx设置为事实上的端口80 。 我想在Apache2上设置django + mod_wsgi。 我很担心,如果我离开Apache2为80会导致冲突。 避免头痛并将Apache更改为另一个端口更好吗? server { listen 80; server_name work.domain.org; access_log /www/work.domain.org/log/access.log; error_log /www/work.domain.org/log/error.log; location / { proxy_pass http://127.0.0.1:8080/; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Magic-Header "secret"; client_max_body_size 10m; } }
我正在运行Drupal并试图找出最好的堆栈来服务它。 Apache + mod_php或Nginx + PHP-FPM 我使用了ApacheBench(ab)和Siege来testing这两个设置,而且我看到Apache性能更好。 这让我感到惊讶,因为我已经听说了很多关于Nginx + PHP-FPM的好消息。 我目前的Nginx设置是有些开箱即用的,PHP-FPM也是如此 我可以通过Apache和mo_php加快Nginx + PHP-FPM组合的优化吗? 在使用ab的testing中,Apache性能明显优于Nginx(更高的请求数/秒和完成testing更快) 我search了一下,但由于我从来没有使用Nginx,PHP-FPM或FastCGI,我不知道从哪里开始 PHP v5.2.13,Drupal v6,最新的PHP-FPM和Nginx源码编译。 Apache v2.0.63 ApacheBench Nginx + PHP-FPM Server Software: nginx/0.7.67 Server Hostname: test2.com Server Port: 80 Concurrency Level: 25 —> Time taken for tests: 158.510008 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 —> Requests […]
我的设置 我在Debian Lenny上运行nginx 0.7.67作为web服务器,而不是作为反向代理。 我正在使用php5-fpm来处理我的PHP请求,这工作正常。 我的目标 我想有一个WordPress安装,这里介绍的清洁WordPress的颠覆安装 。 我想有一个干净的WordPress安装,而不用我的服务器根目录与所有的WordPress文件。 这意味着我的WordPress的安装将在/wordpress和我的主题和插件内/wordpress-content 。 但重要的是,如果您导航到我的域www.example.com,那么您将直接进入WordPress博客,而不必指定WordPress所在的子目录。 我发现了一个在nginx网站上安装wordpress的方法,但不幸的是,这是为了移动整个WordPress目录,而不是将stream量redirect到它。 我尝试了以下configuration: example.conf中的site-available server { listen 80; server_name www.example.com; access_log /var/log/nginx/www.example.com.access.log main; root /var/www/example/htdocs; location / { try_files $uri $uri/ /wordpress/index.php?q=$uri&$args; } include /etc/nginx/includes/php5-wordpress.conf; include /etc/nginx/includes/deny.conf; } 包含php5-wordpress.conf location /wordpress { try_files $uri $uri/ /wordpress/index.php?q=$uri&$args; } location ~ \.php$ { fastcgi_split_path_info ^(/wordpress)(/.*)$; fastcgi_ignore_client_abort […]
我想要在一个nginx访问日志中包含cookie数据,如下所示: (简单例子) log_format foo '$remote_addr "$request" $cookie_bar'; access_log /var/log/nginx/access.log foo; 这对已经有一个cookie“bar”的请求很有效,但是对于我的服务器的第一个请求,nginx会报告“ – ”作为“bar”的值。 看来我的问题是,nginx正在查看Cookie值的请求标头。 有没有办法检查响应中的Set-Cookie并将其用作后备?
我在Nginx 0.8.54试图尽可能实现以下DRYly: 代理直接到localhost:8060如果cookie no_cache为true或者请求方法不是GET 。 否则,从$document_root/static/$uri提供静态文件。 如果不存在这样的文件,请尝试$document_root/cache/$uri和$document_root/cache/$uri.html 。 如果请求path是/ ,请尝试不使用静态文件,只使用$document_root/cache/index.html 。 最后回退到localhost:8060如果找不到静态文件和caching文件。 当前configuration文件: server { root /srv/web/example.com; server_name example.com; location @backend { proxy_pass http://localhost:8060; } location / { if ($cookie_no_cache = true) { proxy_pass http://localhost:8060; } if ($request_method != GET) { proxy_pass http://localhost:8060; } try_files /static/$uri /cache/$uri /cache/$uri.html @backend; } location = / { if […]
我正在运行一个有相当数量编码的文件。 处理500个用户需要大约55秒,但是现在我必须处理1000个用户。 默认的超时时间是60秒,所以我必须增加FastCGI读取超时。 我发现StackOverflow的这个问题 ,说我必须增加fastcgi_read_timeout但我不知道把它放在fastcgi.conf 。