Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nginx vs Apache or using Apache with nginx [closed]

Tags:

nginx

apache

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.

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.

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?

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

like image 620
Anush Avatar asked Oct 30 '25 13:10

Anush


1 Answers

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

Apache:

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

Nginx:

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

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

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.

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

like image 152
joet3ch Avatar answered Nov 02 '25 18:11

joet3ch



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!