我有nginx设置使用4工作进程,但只有其中之一处理所有的请求。 其他三名工人只是闲置。 这里是截graphics式htop nginx.conf看起来像这样 worker_processes 4; events { worker_connections 10240; multi_accept on; use epoll; } worker_rlimit_nofile 20000; http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 30; tcp_nopush on; tcp_nodelay on; client_body_timeout 10; reset_timedout_connection on; ……… 服务器是具有2个CPU核心的EC2 C3大型机器。 任何帮助将非常感谢
我正在使用如下所示的设置将所有未发现的文件redirect到单个回退位置 location / { try_files $uri @missing; } location @missing { rewrite ^(.*)$ /fallback.php last; } 这很好,但我现在有一个更复杂的要求,我有效地需要回退到我的后备。 所以 – 我需要扩展这个,所以如果fallback.php不存在,它会重写为fallback2.php 更新: 这里是我的configuration文件的其余部分用@AD7six在注释中build议的try_files行写的,以防万一PHP处理程序出现问题: server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; server_name ~^(?<subdomain>\w*?)?\.?(?<domain>\w+\.\w+)$; if ($subdomain = "") { set $subdomain "www"; } if (!-d "/home/me/projects/$domain/$subdomain") { set $subdomain "www"; } root /home/me/projects/$domain/$subdomain; index index.php index.html […]
我已经build立了一个反向代理,允许通过HTTPS访问我们的CD软件。 这是我的configuration: server { listen 443; server_name build.example.com; ssl_certificate /etc/ssl/certs/example.com.crt; ssl_certificate_key /etc/ssl/private/example.com.key; ssl on; ssl_session_cache builtin:1000 shared:SSL:10m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4; ssl_prefer_server_ciphers on; access_log /var/log/nginx/example.access.log; location / { 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-Forwarded-Proto $scheme; proxy_pass http://localhost:7777; proxy_read_timeout 90; proxy_redirect http://localhost:7777 https://build.example.com; } location /socket.io/ { proxy_pass http://localhost:7777; […]
我正在使用Nginx向在端口3000上运行的nodejs提供代理请求。以下是我的configuration: server { listen 80; server_name example.com; root /home/example/app; access_log /home/example/access.log; error_log /home/example/error.log; location / { proxy_pass http://localhost:3000; proxy_http_version 1.1; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } } 当我在浏览器中访问该网站时,可以看到服务器的初始响应是一个框架集,然后轮stream加载该页面。 所有这些对于用户来说都是不明显的,直到你将鼠标hover在链接上并且看到IP地址而不是实际的URL。 这是最初的回应(1.1.1.1是我的服务器的实际IP地址): <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>My cool site</title> </head> <frameset rows="100%,*" border="0"> […]
在使用带有PHP-FPM v5.3.3 nginx的设置中,我注意到nginx错误日志中经常发生以下错误: Feb 16 15:00:22 mymachine www.example.com 2015/02/16 15:00:20 [error] 20254#0: *1448249 readv() failed (104: Connection reset by peer) while reading upstream […] 看着php-fpm.log文件,我注意到了以下几点: [16-Feb-2015 15:00:20] NOTICE: [pool www] child 22279 exited with code 0 after 47983.681002 seconds from start [16-Feb-2015 15:00:20] NOTICE: [pool www] child 10625 started 这就是pm.max_requestsconfiguration指令设置的工作者回收。 我(合理地)认为PHP-FPM会在回收工作人员之前提前处理任何接受的连接/请求,因为这个任务并不意味着任何紧急情况。 这是一个configuration错误吗? 这是PHP-FPM 5.3.3的缺陷吗? 这是PHP-FPM所有版本的缺陷吗?
我有两个Websocket服务器,与Zookeeper & Curator一起工作,如果一台服务器出现故障,那么第二个后端活起来。 我按照以下方式configuration它: upstream backend { server 172.31.9.1:8080 max_fails=1 fail_timeout=5s; server 172.31.9.0:8080 max_fails=1 fail_timeout=5s; } server { listen 443; # host name to respond to server_name xxxxxx.compute.amazonaws.com; ssl on; ssl_certificate /etc/ssl/certs/wildcard.dev.xxxx.net.crt; ssl_certificate_key /etc/ssl/certs/wildcard.dev.xxxx.net.key; location / { # switch off logging access_log off; proxy_pass http://backend; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # […]
我有一个本地化的文件夹,有一堆语言(如JSON)文件,我的Web应用程序试图读取浏览器的语言来获取相应的JSON文件。 在某些情况下,相应的语言文件不存在,并且nginx应该返回404。 但是,我想返回一个临时的redirect到默认的语言文件。 我试过这个,但似乎没有工作。 我究竟做错了什么? location /static/l10n { try_files $uri @missing_language; } location @missing_language { rewrite ^ /static/l10n/en-us.json break; } 编辑2 :所以我试着调整try_files有点像这样。 location /static/l10n { try_files $uri /static/l10n/en-us.json; } 但是现在我得到一个500错误。 日志说*35 rewrite or internal redirection cycle while internally redirecting 。 编辑3 :我完整的nginx conf在这里 – https://gist.github.com/paambaati/9782e95b2e9af899b154
我试图通过nginxconfigurationgit-http-backend并且有一些麻烦。 实际结果是,我得到一个PROPFIND请求405错误: 192.168.1.45 – – [22/Feb/2015:16:50:46 +0100] "GET /lw/bla.git/info/refs?service=git-receive-pack HTTP/1.1" 200 0 "-" "git/2.3.0" "-" 192.168.1.45 – – [22/Feb/2015:16:50:46 +0100] "GET /lw/bla.git/HEAD HTTP/1.1" 200 23 "-" "git/2.3.0" "-" 192.168.1.45 – – [22/Feb/2015:16:50:46 +0100] "PROPFIND /lw/bla.git/ HTTP/1.1" 405 172 "-" "git/2.3.0" "-" 版本: Debian GNU / Linux 7.8(wheezy) git版本2.3.0 nginx版本:nginx / 1.6.2 fcgiwrap版本1.0.3 configuration部分: nginx网站configuration server […]
我想知道是否有可能有两个Nginx虚拟主机坐在同一个v4 IP地址上。 我知道存在SNI,但是我有两个不同的证书颁发机构的基本(无SAN,没有通配符)SSL证书,可以在一个IP地址上共同生活。 基本上,设置两个指向自己的KEY和CRT的conf文件(每个虚拟主机一个)足够了吗? 或者还有其他问题吗? 如果可以的话,我会自己尝试一下解决scheme,但是CA需要证书的钱,而且我宁愿订购第二个证书,只要我确信可以使其工作。 注意我不会购买第一个CA的第二张证书,他们的支持很糟糕,我想离开他们。
这是我的.ini文件来运行uwsgi“pyApp.py” [uwsgi] plugins = cgi socket = 127.0.0.1:9010 cgi = /=/usr/share/test/ cgi-allowed-ext = .py cgi-helper = .py=python 我在位置/usr/share/test/firstapp.py有一个“firstapp.py”文件它的内容是 #!/usr/bin/python print "Content-type: text/html\n\n" print "<html><body><h1>It works! Cool!!</h1></body></html>" 我正在用命令运行uwsgi的实例 uwsgi –http :9011 –http-modifier1 9 –ini pyApp.ini –master 我已经使用nginxconfiguration了几个虚拟主机。 而其中的一个必须指向/ usr / share / test /目录,当其中有“/ cgi-bin /”的url时。 nginxconfiguration是 – [也是唯一默认的] server { listen 80 default_server; listen [::]:80 […]