Will switching Simplemachines apache install to Nginx break SMF?

Started by Wellwisher, June 11, 2022, 02:29:47 PM

Previous topic - Next topic

Wellwisher

I run a simple machines forum which runs on an Apache sever but I want to switch to using Nginx.

Why I am switching to Nginx:
My community is growing. I heard Apache is inefficient because it creates a NEW process on the server for every user. Where as Nginx is more an event-based server.

My web-hosting provider has an option whereby, I can change from Apache to Nginx by simply clicking on the dropdown:



However I don't want to break my SMF install. Will simply switching it to 'Nginx' break SMF or will it survive? :laugh:
I know nothing is 100% and it depends on who you host with but I want to get a general idea.

Aleksi "Lex" Kilpinen

#1
Try it, you should be safe to test and switch back if things don't work right.
But, if your host has things properly configured, at most I would expect some features in SMF (like load balancing) to be unavailable on nginx.
Though, Apache vs. Nginx alone does nothing in regards to how PHP is run. What you describe can be, but does not have to be, the case on both.
Nginx is designed so that it should be less resource hungry under stress though.
Slava
Ukraini!


"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Arantor

Quote from: Aleksi "Lex" Kilpinen on June 11, 2022, 02:37:27 PMThough, Apache vs. Nginx alone does nothing in regards to how PHP is run

Yes, it really does, actually.

Apache has choices how it runs PHP, whether that's mod_php or some variation of the FastCGI handling (though mod_php is by *far* the default), while nginx can *only* do php-fpm where you're having a pool of processes ready running, unlike the Apache model.

Yes, you *can* make PHP perform faster under nginx than you can on Apache, that's a given, you also lose .htaccess files and the flexibility they come with - if you have anything using .htaccess (e.g. Pretty URLs) you will have to rewrite it into the core nginx configuration since part of why it performs faster is not traversing the directory structure looking for per-directory rules.

What actually happens in practice is that people put nginx in front of Apache, let nginx soak up the static resources and pass the dynamic stuff to Apache/PHP because in practice unless you're under a *serious* amount of traffic, the spinup time for PHP is not your biggest problem.

If you were in the boat where that was a serious consideration, I'd expect to be hearing talk about running memcache/Redis, tuning the amount of memory given to them, tuning the amount of memory given to opcache, and potentially even using the 7.4+ preloading options ahead of this.

Wellwisher

#3
Thank you both Aleksi "Lex" Kilpinen  & Arantor that's got my brain juices flowing. I think I need to review the SMF .Htaccess file. Luckily I don't use pretty URLs so it seems we may be good to go for a test-run.

I feel it's a good thing I asked. Otherwise it would have been like this homer Simpson scene  ;D  ;D  ;D :


Thank you ya'll, marked as resolved! :D

Advertisement: