Articles of nginx

在Mono上使用ASP.Net最好的服务器是什么?

我正在重新configuration我的网站从头开始,基本上我希望它运行单声道(嗯,在Mono内的ASP.Net) 根据Mono项目 ,似乎有两个选项,Apache或Nginx。 哪一个最适合我? 我在Arch Linux x86-64上运行,所以我有两个包。 而且我不打算(至less在不远的将来)运行任何其他软件,如PHP。 唯一必须支持的是多主机支持,例如foo.com转到网站A,bar.com转到网站B.

WordPress上的Nginx的子目录:访问仪表板?

我想设置一个WordPress博客,但不是一个典型的configuration: 主要网站在www.example.com 。 截至目前,它只是一个静态index.html文件与图像,我们将使用可能是一个index.php显示一些信息和访问该网站的高级部分 博客 ,与WordPress,在www.example.com/blog 我在Nginx下设置了它,但是虽然我能够在www.example.com和我的博客www.example.com/blog上看到我的静态主页,但是我无法访问WordPress的pipe理面板,所以我无法login或写新帖。 这是/etc/nginx/sites-enabled/www.example.comconfiguration文件: server { server_name www.example.com; rewrite ^(.*) http://example.com$1 permanent; } server { listen 80; server_name example.com; access_log /var/www/www.example.com/log/access.log; error_log /var/www/www.example.com/log/error.log info; index index.php; location / { set $php_root /var/www/www.example.com; try_files $uri $uri/ /index.php?q=$uri&$args; } location /blog { set $php_root /var/www/www.example.com; try_files $uri $uri/ /blog/index.php?q=$uri&$args; } ## Images and […]

多个启用SSL的主机会导致nginx缓慢地重新加载

我在我的nginxconfiguration的http级别设置了ssl_certificate和ssl_certificate_key指令。 我面临的问题是,随着更多主机(服务器指令)的添加,启动/重新加载nginx的速度越来越慢。 该服务器大约有1000个启用了SSL的主机,它们inheritance了ssl证书指令。 我知道nginx在加载时validation/检查证书,所以我想知道nginx是否每次启用SSL的主机都inheritance共享证书时检查证书? 如果是的话,不应该只检查一次证书吗? 根据http://nginx.org/en/docs/http/configuring_https_servers.html它应该会导致所有主机inheritance一个单一的内存足迹,但似乎并非如此。 如果这是nginx中的一个错误,如果可能的话完全禁用证书validation可能是一个想法? 任何意见是高度赞赏。

相当于Apache MultiViews的nginx?

如果你把它放在你的.htaccess文件中 Options MultiViews 你有这些文件 stuff/ howto.html index.php items.php 那么所有这些url都可以工作 /stuff/ # brings up /stuff/index.php. # Yes, this would have worked `# even without MultiViews /stuff/howto # brings up /stuff/howto.html. #`This would not have # worked without MultiViews, # although you could have done # it with a Rewrite rule, too /stuff/items # brings up /stuff/items.php […]

nginx作为smtp代理

我被命令将nginxconfiguration为SMTP代理。 这就是我所有的细节。 我已经看了一些书籍和文档,没有看到这样的configuration的任何例子,也没有解释为什么这可能是有用的。 也许,通过HTTP服务器来处理SMTP AUTH以减less负载,我不知道。 有人能指出我对这种设置的意义吗? 我的nginx.conf是默认的,没有更改,我不认为你会问我这件事。 有人会分享他的SMTP代理configuration经验吗?

Nginx + Passenger:停止file upload30秒后超时

我有一个运行在乘客和nginx下的ruby应用程序。 如果我尝试上传一个较大的文件(比如15+ meg),那么当它上传到30s时,上传会重新启动(根据chrome),在下一个30秒结束时,它会放弃,我会暂停。 有没有一个选项,我可以把我的nginxconfiguration,以防止这种情况发生? 这是我目前的nginxconfiguration看起来像: worker_processes 1; events { worker_connections 1024; } http { passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.2; passenger_ruby /usr/local/bin/ruby; include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; gzip on; gzip_min_length 1000; gzip_proxied expired no-cache no-store private auth; gzip_types text/plain application/xml text/css text/javascript application/x-javascript; gzip_disable "MSIE [1-6]\."; server { listen 80; server_name alekskrotoski.com; root /var/www/apps/akrotoski/public; # <— […]

分析uwsgi strace日志以找出为什么需要高CPU使用率

我正在通过uwsgi与nginx运行django网站。 问题是当stream量变大时,uwsgi进程需要很多的CPU时间。 相同的configuration在testing服务器上正常工作,siege / ab模拟大量的并发stream量。 这里是uwsgi进程的一个strace日志。 http://dl.dropbox.com/u/43017476/strace.log 还有一些sysctl: fs.file-max = 128000 net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 net.ipv4.tcp_rmem = 4096 87380 16777216 net.ipv4.tcp_wmem = 4096 65536 16777216 net.core.netdev_max_backlog = 4096 net.ipv4.tcp_max_syn_backlog = 4096 net.core.somaxconn = 250000 net.ipv4.tcp_keepalive_time = 300 nginx conf与Google的其他教程非常相似。 我一直在试图弄清楚,但没有运气。 不过,我发现了很多这样的东西: 22:12:02.932276 read(8, "\7\0\0\2\0\0\0\2\0\0\0", 16384) = 11 22:12:02.932504 poll([{fd=8, events=POLLIN|POLLPRI}], 1, 0) = […]

nginx + @ font-face + Firefox / IE9

只是把我的网站从一个共享主机转移到了Linode的VPS上,而且我对nginx也是全新的,所以如果我错过了一些明显的东西,请不要苛刻^^ 我的WordPress网站在Nginx和MaxCDN上运行得非常好,但我的@ font-face字体(从cdn.domain.com提供)在IE9和FF中停止工作(@ font-face失败的跨源请求。受到限制。) 我GOOGLE了几个小时,并尝试添加以下所有到我的configuration文件: location ~* ^.+\.(eot|otf|ttf|woff)$ { add_header Access-Control-Allow-Origin *; } location ^/fonts/ { add_header Access-Control-Allow-Origin *; } location / { if ($request_filename ~* ^.*?/([^/]*?)$) { set $filename $1; } if ($filename ~* ^.*?\.(eot)|(otf)|(ttf)|(woff)$){ add_header 'Access-Control-Allow-Origin' '*'; } } 当然,每次更改之后我都重新启动了nginx。 不pipe我做什么,标题都不会被发送。 我有默认的Ubuntu的apt-get构buildnginx的默认应该包括头模块…如何检查什么模块安装,或者还有什么可能导致此错误? 更新: 我试过运行curl -I [location-of-the-font] ,它确实返回Access-Control-Allow-Origin: *但是在Chrome的“networking”面板中该标题不可见,并且字体在FF中仍然不起作用&IE9(CSS3117:@ font-face失败的跨源请求,资源访问被限制) – 任何想法可能导致这个?

需要一些帮助优化Nginx中的301redirect

我刚刚为一个网站创build了一个新的结构,我需要一些帮助redirect到新的地方。 这个代码在这里,但我想这可以优化很多。 location = /nl { rewrite ^ $scheme://$server_name permanent; } location = /nl/ { rewrite ^ $scheme://$server_name permanent; } location = /en { rewrite ^ $scheme://$server_name permanent; } location = /en/ { rewrite ^ $scheme://$server_name permanent; } location = /nl/contact { rewrite ^ $scheme://$server_name/contact/ permanent; } location = /en/contact { rewrite ^ $scheme://$server_name/contact/ permanent; […]

Nginx,uWSGI,Python,用户,组和权限。 关于安全的问题

好的,昨天我终于得到了在我的电脑上运行的nginx和uWSGI服务器。 Nginx和uWSGIconfiguration文件,新用户,组和他们的权限,以及基于Web上可用知识configuration的SSH的chrootdir。 不幸的是,我不太相信它,所以我想问问系统pipe理员,如果我没有在某个地方犯过一个很大的错误,那么总有一天我会告别服务器。 对于HTTP服务器,我只使用/ srv目录,其结构和权限如下: drwxr-xr-x 2 root root 4096 2012-02-03 04:16 nginx -rw-r–r– 1 root root 411 2012-02-03 04:25 Site1.conf -rw-r–r– 1 root root 170 2012-02-02 23:59 Site2.conf drwxrwxr-x 2 root www 4096 2012-02-03 04:25 sockets srw-rw—- 1 Site1-www www 0 2012-02-03 04:25 Site1.socket drwxr-xr-x 2 root root 4096 2012-02-03 04:09 uwsgi -rw-r–r– 1 […]