我有以下的Nginxconfiguration: http { … proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m; proxy_temp_path /var/tmp; … upstream webhook_staging { server 127.0.0.1:4001; keepalive 64; } location /webhooks/incoming_mails { client_max_body_size 60m; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header Connection ""; proxy_http_version 1.1; # Does not work for HEAD requests #>> proxy_cache one; #>> proxy_cache_key […]
我得到了这个Flask应用程序,我在这个共享服务器上用127.0.0.1:5002上的gunicorn运行。 我有一个自己的nginx实例,我可以添加自定义configuration。 nginx目录的结构是这样的: ~/.nginx | conf.d | nginx.conf | […] 其中nginx.conf包含以下内容: pid /media/sdl1/home/USERNAME/.nginx/pid; error_log /media/sdl1/home/USERNAME/.nginx/error.log; worker_processes 1; worker_rlimit_nofile 65535; events { worker_connections 8192; } http { include /etc/nginx/mime.types; default_type application/octet-stream; access_log off; sendfile on; tcp_nopush on; real_ip_header X-Forwarded-For; client_max_body_size 1g; client_body_temp_path /media/sdl1/home/USERNAME/.nginx/client; fastcgi_temp_path /media/sdl1/home/USERNAME/.nginx/fastcgi; uwsgi_temp_path /media/sdl1/home/USERNAME/.nginx/uwscgi; scgi_temp_path /media/sdl1/home/USERNAME/.nginx/scgi; include conf.d/*.conf; } 现在指向conf.d目录,其中包含一个名为000-default-server.conf的文件和一个名为000-default-server.d的空目录 000-default-server.conf包含这个: server { […]
我正在尝试代理[ http:// localhost:5984]到[ http:// localhost / couchdb] 。 我正在运行nginx的代理。 我遵循http://wiki.apache.org/couchdb/Nginx_As_a_Reverse_Proxy中提到的相同的方法, location /couchdb { rewrite /couchdb/(.*) /$1 break; proxy_pass http://127.0.0.1:5984; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; } 但是当我运行curl本地主机/ couchdb我得到以下错误 {"error":"not_found","reason":"no_db_file"} 但是,当我运行curl localhost:5984我从couchdb得到了有效的响应。 {"couchdb":"Welcome","uuid":"337bb4394efe84536a68a63eee55333f","version":"1.5.0","vendor": {"name":"The Apache Software Foundation","version":"1.5.0"}} 但是当我运行curl本地主机:5984 / couchdb我得到了同样的错误(和日志),我通过反向代理接收。 couchdb日志文件如下所示 [Fri, 24 Jan 2014 20:41:29 GMT] [debug] [<0.120.0>] 'GET' /couchdb […]
我正在玩不同的configuration设置。 目前我在同一台机器上有80端口的Varnish-cache,70端口的Apache2和90端口的Nginx。 Varnish的configuration方式默认与Nginx通信,例如:config .host = "localhost"; .port = "90"; .connect_timeout = 60s; .first_byte_timeout = 300s; .between_bytes_timeout = 300s; .probe = basic; 我的问题是,如果Nginx死了,如何使Varnish fallback到Apache? 使用Apache的Varnish的基本configuration是这样的。 .host = "localhost"; .port = "70" .connect_timeout = 60s; .first_byte_timeout = 300s; .between_bytes_timeout = 300s; .probe = basic; 如果第一个configuration失败,我想触发这个configuration(我不能完全放在单词中,但是,如果Nginx死了,我想清除Ping Apache)。 任何关于configuration的提示或build议都会很有帮助。 谢谢。
我们正在使用nginx,现在1.6反向代理我们的服务到客户端。 我们还使用Server-Sent Events,这是HTTP之上的一层,可以使套接字保持打开状态。 这是一个需要的configuration。 proxy_buffering off; proxy_http_version 1.1; 这是我们的设置 Client <—> nginx <—> Service Socket 1 Socket 2 当我closures浏览器而没有正确断开连接时,套接字1closures,而套接字2仍然打开。 该服务正在看到nginx仍然连接,并仍然继续在那里推送消息。 这是我用wireshark看到的场景。 Client -XXX- nginx <—> Service Socket 1 Socket 2 有没有办法让nginxclosures套接字2? HTTP的Connection: keep-alive导致任何不良行为?
试图改变一个页面的内容我通过一个nginx服务器反向代理。 我试过用nginx_substitutions_filter没有运气。 有谁知道这是否可能,以及如何下降。 例如 – 想要用http://lotsoffoos.com上的barreplacefoo所有实例 location / { proxy_set_header X-Real-IP $remote_addr; proxy_pass https://lotsoffoos.com; proxy_read_timeout 90; subs_filter_types text/html text/css text/xml; subs_filter “foo” “bar" gir; }
我有两条路线,我想通过两个节点进程(websocket路由,angular度的应用程序),而第三条路线需要传递给一个PHP应用程序,充当angular应用程序的restAPI。 我不是非常精通nginx 这是我的尝试: user www-data; worker_processes 4; pid /run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # Logging Settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # Gzip Settings ## […]
我必须在各种应用程序服务器(一开始,这将是JBoss 6,Tomcat 8独立和Tomcat 8embedded到Spring引导1.2应用程序)与Apache 2.4。 因此,我决定去mod_proxy(而不是jk,ajp或类似的东西)。 从我所知道的我设置Apache和应用程序服务器重用/池连接。 但是当我计算开放端口的数量时,我看到了几千个: $ netstat | grep :80 | wc -l 4630 (我在Windows上,上面的命令在Cygwin中运行,所以不要混淆,Apache等运行本地,这意味着没有cygwin模拟层)我可能已经预计可能有一千个端口,但不是更多。 这是我的Apache反向代理configuration: <VirtualHost *:80> ServerAdmin … ProxyRequests Off ProxyPreserveHost On ProxyPass / http://localhost:8080/ connectiontimeout=5 timeout=30 ProxyPassReverse / http://localhost:8080/ ServerName … ErrorLog "logs/foo.log" CustomLog "logs/foo-access.log" common </VirtualHost> MPM是活跃的,我可以使用多达150个传入连接,至less这是我从判断服务器状态来判断… … 1 requests currently being processed, 149 idle workers … ..和Apache的configuration: […]
是否有可能使用Nginx从这样的URL代理: http://example.com/service/1234/foo.php?… 到像这样的内部服务: http://example.com:1234/foo.php?… 也就是说,从URL中提取一个数字,并将其作为端口号使用到同一台服务器上? rewrite似乎仅限于操作端口后的URL部分,我不认为proxy_pass可以从中访问正则expression式的子string。 我试图解决的具体问题是,我的服务都可以在端口80上访问,因为各种公司和公共networking阻塞了实际运行服务的异国情调的端口。 所以它必须是一个反向代理,而不是一个redirect。 此方法适用于单个端口: location /service/5010 { rewrite ^/service/5010/(.*)$ /$1 break; proxy_pass http://127.0.0.1:5010; } 但问题是如何使5010只是从URL中提取的参数。
我在aws ec2上的ubuntu 14.04服务器上安装了apache 2.4的joomla 3.x站点。 这一点很好,与url重写工作正常。 在释放nginx的端口80之前,我清除了所有的apache问题。 我对nginx没有特别的问题,即使我几乎没有开始使用它,这是第三次部署。 我用基本的东西逃脱了。 我跟着howtoforge的教程。 设置完成后 我意识到只索引页面加载正常,所有其他页面期望index.php? 在域名和可爱的url之间 stage.domain.com/bla/bla # doesn't work stage.domain.com/index.php?/bla/bla/ # works 我看到有这么多人遇到这个问题,但是他们要么直接在nginx中,要么直接在apache中托pipejoomla。 解决scheme的接近nginx在Apache主机joomla前面将无法正常工作,可能我没有正确的nginx理解,所以请忍受我。 以下是configuration: #/etc/nginx/site-enabled/stage.domain.com.vhost server { listen 80; server_name www.stage.domain.com stage.domain.com; root /var/www/html/vhosts/stage.domain.com/htdocs_april; index index.php index.html; location / { try_files $uri @proxy; } location ~* \.(js|css|jpg|jpeg|gif|png|svg|ico|pdf|html|htm)$ { expires 5d; } location @proxy { proxy_pass_header Server; […]