Articles of nginx

Nginx的语言redirect:/de/test/test.php到/test/test.php?

我正在尝试在新服务器上configurationNginx。 我有一些PHP脚本(fe /test/test.php),我想用“原样”(默认语言,英文)以及语言redirect。 示例 – 当请求“/de/test/test.php”时, nginx写入一个cookie(lang = de) 并返回“/test/test.php”(不修改URI,以便访问者保持在“/de/test/test.php” 任何帮助是极大的赞赏! 我已经失去了几个晚上的斗争,我已经绝望了,取消新的服务器,并返回到共享主机。 谢谢!

nginx和Varnish之间的连接

我在后台使用nginx作为反向代理与清漆。 我有LAMP燃料清漆。 我在Varnish服务器上看到的问题是,每当请求被提供时,nginx的连接就build立起来了。 我们服务超过300个需求/秒,我们看到的东西是这样的: netstat -an|awk '/tcp/ {print $6}'|sort|uniq -c 2 ESTABLISHED 1 FIN_WAIT1 7 LISTEN 1 SYN_RECV 43187 TIME_WAIT 这当然是不希望的。 最好的是我们在nginx和varnish之间build立一个隧道或连接,并且所有的通信都通过这个静态连接进行。 我不太确定如何做到这一点,或者有更好的方法来做到这一点。 我还能在这里做什么? 谢谢

Nginx:保护目录和文件

我写这个来防止目录“下载”被访问,但从IP 1.2.3.4。 location ~ /folder/download { allow 1.2.3.4; deny all; return 403; } 但是,目录“文件夹”也被阻止,我不想这个。 我究竟做错了什么? 更新: 这里是所有真正的configuration: server { server_name www.domain.com; rewrite ^ $scheme://domain.com$request_uri? permanent; } server { server_name atpc.info; access_log /var/log/nginx/atpc.info.access; error_log /var/log/nginx/atpc.info.error; root /var/www/atpc.info; location ^~ folder/download { allow 1.2.3.4; deny all; } location ^~ folder/includes { allow 1.2.3.4; deny all; } location […]

带有HTTPS的Nginx://保持下载/index.php,但一切正常

我已经安装nginx并将我的服务器转移到nginx(从apache)。 我做了一个具有SSL的子域。 我的http://工作完美..但是当我访问https://secure.gamegambit.com它开始下载文件。 然而任何其他的url与https:/ /工作正常,如https://secure.gamegambit.com/gamegambit-wiki.html nginx默认configuration: server { listen 443; server_name secure.gamegambit.com; root /var/www/; index index.php index.html index.htm default.html default.htm; ssl on; ssl_certificate /root/gamegambit.crt; ssl_certificate_key /root/gamegambit.key; ssl_client_certificate /root/gs_intermediate_ca.crt; ssl_session_timeout 5m; ssl_protocols SSLv3 TLSv1; ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP; ssl_prefer_server_ciphers on; ## Default location location / { try_files $uri $uri/ /index.php?q=$request_uri; } location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ { access_log off; expires […]

如何configurationPlesk使用nginx的子域?

我已经尝试在我的全新Linux服务器上安装Plesk 10.3(最新版本),并为端口8226创build了一个新的nginx子域 – 我如何configurationPlesk使用nginx作为在Plesk中创build的子域的服务器?

对于有大量stream量的网站,任何Nginxconfigurationbuild议

安装了Nginx的服务器每秒钟可以获得大约50个连接。 有时,它每秒钟达到150个连接。 它有7GB的RAM内存。 这是第一次使用Nginx,不确定默认configuration是否适合这种types的服务器。 任何build议如何configurationNginx的服务器有很多的连接和大内存。 这是EC2大实例: 大型实例7.5 GB内存,4个EC2计算单元(2个虚拟核心,每个EC2计算单元2个),850 GB本地实例存储,64位平台

Phusion Passenger + Nginx – 架构?

我正在使用Phusion Passenger + nginx来部署一个Rails应用程序。 到目前为止,所有人都在非常努力地工作。 不过,我对乘客+ nginx的架构有点模糊,我想加深我的理解。 任何人都可以提供关于架构如何工作的良好概述,为什么它能够很好地工作以及解决scheme的优缺点是什么? 写下你自己或者联系我,而不是困扰任何一方 – 是的,我做了Google,我确实检查了乘客文件。 要么我找不到东西,要么很容易发现。

WordPress只显示内部IP

昨天,我创build了一个WordPress“集群”。 现在我有一个问题:WordPress和统计插件只显示用户作为内部IP地址像10.0.0.2。 我的nginxconfiguration是: upstream backend { #ip_hash; server 10.0.0.3:80; server 10.0.0.2:8080; } server { listen 80; server_name bloggingsite.org; location / { proxy_pass http://backend; proxy_redirect off; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # client_max_body_size 10m; # client_body_buffer_size 128k; # proxy_connect_timeout 90; # proxy_send_timeout 90; # proxy_read_timeout 90; # proxy_buffer_size 4k; # proxy_buffers 4 […]

你如何使用nginx在Apache的前面提供多个域的静态文件?

我想从同一台服务器运行多个域。 我想nginx坐在Apache的前面,并提供静态文件。 因此请求one.com/site_media/logo.png指向/var/www/one/site_media/logo.png和two.com/site_media/logo.png指向/var/www/two/site_media/logo.png 。 我在哪里出错在以下configuration? ports.conf NameVirtualHost *:80 Listen 8080 nginx的/网站可用/ one.com server { listen 80; server_name one.com; access_log /var/www/one/nginx_access.log; error_log /var/www/one/nginx_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; } location ^~ /site_media/ { root /var/www/one; if ($query_string) { expires max; […]

Nginx和长时间轮询:减less内存和带宽占用的最佳实践

我在这种模式下使用nginx进行BOSH和聊天客户端连同gzip。 location ~* /http-bind/ { proxy_buffering off; keepalive_timeout 55; access_log off; tcp_nodelay on; proxy_pass http://xxxx:1111; } 这是在nginx中pipe理长轮询的最佳方法。 我也只使用一个工作进程来完成networking聊天(单个CPU)。 那很好吗?