我正在尝试在同一台服务器上沿着自己的云实例设置一个gitlab实例。 两者都可以正常工作,如果启用了一个主机,则两者都可以正常工作。 奇怪的是,自己的云主机捕获所有的请求到服务器,即使站点configuration只说它应该赶上一个合适的域,从而防止gitlab虚拟主机应答。 自己的云: upstream php-handler { # server 127.0.0.1:9000; server unix:/var/run/php5-fpm.sock; } server { listen 80; server_name cloud.example.com; return 301 https://$server_name$request_uri; # enforce https } server { listen 443 ssl; server_name cloud.example.com; ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem; ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key; # Don't show version server_tokens off; # Have separate logs for this vhost access_log /var/log/nginx/owncloud_access.log; error_log /var/log/nginx/owncloud_error.log; # […]
我在后端服务器之间configuration了Nginx负载平衡。 upsteam backend { server 127.0.0.1:8080; server 127.0.0.1:8081; server 127.0.0.1:8082; server 127.0.0.1:8083; } server { … location / { … proxy_pass http://backend; } } 一个坏的请求进来了,后端应用程序无法处理它,它崩溃了。 所以Nginx从请求的上游尝试每个服务器,取下所有的应用程序实例。 是否有可能告诉Nginx在返回错误响应之前最多尝试一半来自上游的服务器?
我在CentOS上有一个非常受欢迎的nginx web服务器,它提供了大量的静态内容。 当并发连接数量低时,服务器可以轻松提供高达4Gb的stream量,但是当并发连接数量增加时,服务器性能将下降到400Mb,I / O利用率达到100%。 我尝试了SSDcaching,使用noatime挂载文件系统,更改I / O调度程序,增加服务器内存高达256GB,nginx上的不同configuration,如aio,文件发送,但没有成功。 有没有其他的configuration来改善它的性能?
我有这个定义一个别名(最新的迭代): location ~ /xxx/(.*).php($|/) { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /xxx/web/blog/xxx/$1.php; include fastcgi_params; } location ~ /xxx(.*) { autoindex on; alias /xxx/web/blog/xxx$1; } 要尝试在xxx.com的xxx目录中定义一个wordpress安装(例如)。 现在,当我拿出PHPpath时,我得到的index.php文件下载到我的电脑,但一旦我添加PHP的FPM,由PHP位置定义,我得到: 在读取来自上游的响应标题时,FastCGI以stderr发送:“主脚本未知” 在日志中。 我已经尝试在错误日志中的debugging模式,但它看起来不错。 我有一个PHP位置已经在做: location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; try_files $uri =404; # # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index […]
使用log_format可以包含一系列variables,例如$ http_user_agent: http://nginx.org/en/docs/http/ngx_http_core_module.html#variables 但是有可能包含一个来自PHP-FPM的variables吗? 例如,我想在access_log包含login用户的ID。 一种可能性是在PHP中设置一个头文件,然后使用$ sent_http_XXX: log_format inc_info '… [$sent_http_x_user_id] …'; access_log /var/log/nginx/access.log inc_info; <?php header('X-User-ID: ' . head(USER_ID)); ?> 但是,这是有点不好意思(在向浏览器发送值的时候),如果在PHP中使用register_shutdown_function() (例如,如果要显示数据库处理时间),则不起作用,因为头文件已经发送。 这可以通过以下方式在Apache中完成: LogFormat "… [%{USER_ID}n] …" inc_info CustomLog /var/log/httpd/access_log inc_info 与相应的PHP: if (function_exists('apache_note')) { apache_note('USER_ID', USER_ID); }
最近在一个服务器上安装了django 1.6,这个服务器托pipe了几个基于django的站点,我收到了很多“ERROR:Invalid HTTP_HOST header”的错误。 这是一个已知的“function” 。 问题是请求是从非浏览器触发错误,但不是按照nginxconfiguration(Nginx 1.6.0)转发。 例如,我已经设置了一个默认的服务器(这也是第一个在configuration文件中): server { listen 80 default_server; location / { return 403 "Forbidden"; } } 这适用于浏览器(当我testing它),但是,不知何故,这是被随机机器人绕过(和洪水我的电子邮件)。 例如,请求IP地址或autodiscover.mydomain.com (可能是一个outlook/交换的东西?) 我也试过这个答案 ,但无济于事,因为他们正在绕过默认configuration。 有没有办法阻止这种types的访问?
我的应用程序只是一个用django编写的REST API。 没有静态内容或html页面。 在设置我们的生产环境时,我们计划使用amazon ELB(负载均衡器)来平衡运行django和uWSGI的许多EC2实例之间的请求。 有了这个设置,我们是否需要(或想)使用像nginx这样的web服务器来处理接受的http请求并将它们传递给uWSGUI? 什么好处(如果有的话),这将提供我们只是在networking服务器上运行uWSGI并让它直接从负载均衡器接受HTTP请求? 谢谢!
我已经添加了一个新的SSL证书到我的nginx服务器(我已经做了很多次之前)。 但是,当我重新启动nginx,没有网站正在工作。 当我运行configtest时,它说: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful 如果nginx运行,我运行nginx重新加载,网站和新的SSL证书正在工作。 只有当Nginx重新启动时,我得到如下: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful Stopping nginx: [ OK ] Starting nginx: 所以在启动nginx后没有任何反应。 没有消息写入nginx错误日志。 如果我只是使用“开始”,往往它的工作。 我能做些什么来解决这个问题,这可能是什么原因造成的?
我在这个docker容器的最新ubuntu上运行wordpress 4.0: https://github.com/eugeneware/docker-wordpress-nginx wordpress也运行在另一个nginx反向代理之后,但在wordpress上一切似乎都正常。 我试图用wp-discourse把它和一个工作的话语实例联系起来。 无论如何,它不工作,它有两种方式: 1)评论没有显示在post中,也链接被打破: http://it.servermeta.net/ciao-mi-chiamo-gio-ho-7-figli-una-pentola/ 2)论坛post没有创build。 我发现的唯一有意义的错误是: 2014/09/17 22:57:42 [error] 428#0: *1038 FastCGI sent in stderr: "PHP message: PHP Warning: First parameter must either be an object or the name of an existing class in /usr/share/nginx/www/wp-content/plugins/wp-discourse-master/wp-discourse.php on line 410 PHP message: PHP Warning: file_get_contents(/wordpress.json?best=5&min_trust_level=1&min_score=30&min_replies=5&bypass_trust_level_score=50): failed to open stream: No such file or […]
我有高TTFB时间的问题,特别是发送后的等待时间。 网页testing显示TTFB差不多是4秒。 平托指定等待时间是这里的瓶颈 这里是我的Magento + Nginx服务器的设置,查看testing和configuration的截图http://share.pho.to/#7BuP9 操作系统:Ubuntu 14.04服务器 nginx的/ 1.4.6 PHP 5.5.9 opcache 7.0.3 memcached的 PHP-FPM Magento 1.9.0.1 Linode 2GB / 2核心服务器 Nginx服务器configuration server { server_name dev.magibooks.com; return 301 $scheme://www.dev.magibooks.com$request_uri; } server { listen 80; #listen 443 ssl spdy; #ssl on; #ssl_certificate /etc/nginx/ssl/dev/ssl-dev-unified.crt; #ssl_certificate_key /etc/nginx/ssl/dev/ssl-dev.key; server_name www.dev.magibooks.com; root /var/www/www.dev.magibooks.com/web; ## rewrites dev.magibooks.com to www.dev.magibooks.com #if […]