Apache和Nginx在一起,为什么? [英] Apache and Nginx together, why?

查看:79
本文介绍了Apache和Nginx在一起,为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为远程安装了流行的控制面板服务,称为VestaCP( https://vestacp.com/)linux服务器.默认情况下,它同时安装了apache和nginx,但是尽管我尽了最大的努力,但我仍然无法弄清为什么我需要两者.我对apache以及如何配置它很熟悉,但是我以前从未使用过nginx.它似乎是一种更快,更苗条的Apache.你为什么要两个呢?为什么不选择一个呢?在VstaCP设置中,似乎可以激活/停用网站的Nginx(代理支持NGINX),但是如果没有Apache,就无法单独使用Nginx.

I have installed a popular control panel service called VestaCP (https://vestacp.com/) for my remote linux server. By default it installed both apache and nginx, but despite my best efforts I still can't work out why I need both. I'm familiar with apache and how to configure it, but I've never used nginx before. It appears to be a faster, slimmer apache. Why would you want both? Why not opt for a single one? In the VstaCP settings, it appears I can activate/deactivate Nginx (Proxy Support NGINX) for a website, but I can't use Nginx on its own without apache.

我发现我有一个非常相似的apache conf和一个nginx conf(写的不同,但是逻辑是相同的).我不确定,但这表明实际上只有一个人在听,虽然不确定是哪个.

I've found I have an apache conf and an nginx conf that are very similar (differently written, but the logic is identical). I'm not sure, but it suggests only one is actually listened to, not sure which though.

我很困惑.帮助.

推荐答案

Nginx是越来越轻,但是由于 .htaccess 支持,很多人发现使用Apache更容易( Nginx确实可以由于性能问题而没有类似产品).

Nginx is faster and lighter, but many people find it easier to work with Apache because of .htaccess support (Nginx does not have an analog due to performance concern).

典型方案如下:将Nginx绑定在端口 80 上,将其配置为提供静态文件(jpg,png,js,css,ttf等),并使其代理到Apache例如,用于非静态资源的端口 8080 .反过来,Apache也具有上述 .htaccess 支持,该支持使您可以应用重写规则和其他内容,而无需重新加载Web服务器.

The typical scheme is following: you bind Nginx on port 80, configure it to serve static files (jpg, png, js, css, ttf, etc.), and make it proxy to Apache on, say, port 8080 for non-static resources. Apache in turn has abovementioned .htaccess support which allows you to apply rewrite rules and other stuff without webserver reload.

这篇关于Apache和Nginx在一起,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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