Nginx的VS Apache或使用Apache nginx的 [英] Nginx vs Apache or using Apache with nginx

查看:139
本文介绍了Nginx的VS Apache或使用Apache nginx的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在运行一个网站,该网站服务器的JavaScript小部件约2年。现在的问题是我是否应该nginx的纯粹使用,或者我应该继续使用Apache nginx的。

I have been running a website which servers javascript widgets for about 2 years. Now my question is whether I should use nginx purely or I should continue using apache with nginx.

我每天约200标志起坐,这意味着,有时插件的请求率在2000年上升了一天。所以,现在的问题是切换到nginx的意思,我将无法使用,我使用了Apache重写规则。

I have about 200 sign ups a day and that means that sometimes the request rate for widget goes up by 2000 a day. So, now the problem is switching to nginx means that i would not be able to use the rewrite rules that i am using in apache.

现在这是一个问题,我知道的,但是没有办法,我可以期待我在Apache的一个不Nginx的环境中看到的任何其他问题?

Now that is one problem I know of, but are there any other issues that I can expect to see in an nginx environment that I dont in Apache?

你会建议我纯粹切换到nginx的或留在Apache和Nginx的反向代理?

Would you suggest me to switch purely to nginx or stay with apache and nginx as reverse proxy?

推荐答案

您可以仍然使用Apache的重写规则,有轻微的修改(我把这个距离的 Nginx的底漆):

You could still use the rewrite rules from Apache, with slight modifications (I took this from Nginx Primer):

阿帕奇:

RewriteCond   %{HTTP_HOST}   ^example.org$   [NC]
RewriteRule   ^(.*)$   http://www.example.com/$1   [R=301,L]

Nginx的:

Nginx:

if ($host != 'example.org' ) {
    rewrite  ^/(.*)$  http://www.example.org/$1 permanent;
}

另一个问题是.htaccess文件,但是这只会是一个问题,如果你与其他人共享服务器。

Another issue is .htaccess files, but this would only be an issue if your sharing the server with others.

我也研究了你依赖于任何Apache模块,并确保Nginx的等价物包括相同的功能。肯定与测试Nginx的你的web应用在测试环境中第一个确定的任何问题。

I would also research any Apache modules that your relying on and ensure that the Nginx equivalents include the same functionality. Definitely test your webapp with Nginx in a test environment first to identify any issues.

在最后,如果你的目标是更好的性能,然后从Apache到Nginx的迁移应该是值得的。

In the end, if your goal is better performance then the migration from Apache to Nginx should be worth it.

这篇关于Nginx的VS Apache或使用Apache nginx的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆