Nginx 和 Apache 有什么区别?
我不太明白 Nginx 和 Apache 有什么区别?
我想使用 PHP Comet 技术进行聊天。我确实喜欢这样:
while($modification_date == filemtime($filename)) {
sleep(2);
}
//$filename was updated and we retrieve new messages and give them to the user with JSON help
它当然在 Apache 中不起作用。它能在 Nginx 中工作吗?
请不要向我提供 NodeJS 和其他内容。
I don't quite get what is the difference between Nginx and Apache?
I want to use PHP Comet technique for the chat. I do like that:
while($modification_date == filemtime($filename)) {
sleep(2);
}
//$filename was updated and we retrieve new messages and give them to the user with JSON help
It of course doesn't work in Apache. Will it work in Nginx?
Do not offer me NodeJS and other, please.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Apache 和 Nginx 之间的主要区别是一个是线程驱动的,另一个是事件驱动的。但是,我认为你的问题不清楚。它们与您的代码片段无关。首先解释一下为什么它在 Apache 中不起作用。
Main difference between
Apache
andNginx
is one is thread driven and another is event driven. But, I think your question is not clear. They have nothing to do with your code snippet. And first explain why It'll not work inApache
.Nginx
不会自动使该代码工作。它会像在 Apache 中一样糟糕。主要问题是 PHP 不是线程安全的,每个请求都需要一个分叉的 PHP 过程来处理该请求。这意味着需要大量的 RAM 才能扩展到任何合适的大小。Nginx
可以通过不同的编程风格(comet)和扩展的帮助来解决这个问题。Nginx
doesn't automagically make that code work. It will suck equally as bad as it did in Apache. The main problem is that PHP isn't threadsafe and each request needs one forked PHP proc to handle the request. This translates into insanely large amounts of needed RAM to scale to anything of decent size.Nginx
can get around this problem by a different style of programming (comet) and the help of an extension.