New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Can you review my Wordpress nginx conf? Appreciate a little optimization.
sudoranger
Member
in Help
The following conf is working perfectly fine. I'm currently using Let's Encrypt and forwards all traffics from
1) www http (http://www.lowendnigh.com)
2) www https (https://www.lowendisnigh.com)
to
3) non-www https (https://lowendisnigh.com)
4) Wordpress pretty URL enabled
However, since coming from Apache to Nginx I'm rather noob. I need to know if I miss something or added too much unnecessary stuff...
$ nginx -v
nginx version: nginx/1.14.0 (Ubuntu)
/etc/nginx/nginx.conf
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 1024;
}
http {
include /etc/nginx/lowendisnigh.com.conf; include /etc/nginx/mime.types;
}
pid /run/nginx.pid;
user www-data;
worker_processes auto;
/etc/nginx/lowendisnigh.com.conf
server {
listen 80; listen [::]:80; return 301 https://lowendisnigh.com$request_uri;
}
server {
listen 443 default_server http2 ssl; listen [::]:443 default_server http2 ssl; access_log /var/log/nginx/lowendisnigh.com.access.log; error_log /var/log/nginx/lowendisnigh.com.error.log; index index.html index.php; root /home/sudoranger/lowendisnigh.com; server_name lowendisnigh.com www.lowendisnigh.com; client_max_body_size 128M; default_type application/octet-stream; fastcgi_read_timeout 600; gzip on; keepalive_timeout 60; sendfile on; send_timeout 600; tcp_nodelay on; tcp_nopush on; types_hash_max_size 2048; include /etc/letsencrypt/options-ssl-nginx.conf; ssl_certificate /etc/letsencrypt/live/lowendisnigh.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/lowendisnigh.com/privkey.pem; ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; include snippets/fastcgi-php.conf; } location ~ /\.ht { deny all; }
}
Disclaimer: Domain name isn't real, it's for the sake of this discussion only.
Thanked by 1gol3m
Comments
*Silently gets in the corner of the office, ducks and cries
Joins.
I'd recommend to give a peep at what our @eva2000 does with centminmod
Actually, try to deploy it and give a good look at it; even if you're not a CentOS person (I'm not) you can get some inspirations for your Debian deployment
Also:
https://nginxconfig.io/?wordpress
^> @mfs said:
this. Centminnod is all you need for optimal WordPress. I use it on all my sites... Wp-cli support, easy to navigate.
this apaache and nginx is kinda screwed up for me so I use openlitespeed + openlitespeed web admin + name based virtual hosting + mariadb for all of my sitez
have you even seen centminmod minimum recommended requirements? don't just casually recommend something
I'd humbly suggest you to take a deep breath and re-read the comment you're quoting. Besides, I miss entirely your (attempted) argument about the minimum requirements that project suggests, and their relevance with the topic.
It's an interesting project to look at regardless of the fact you're going to use CentOS or Wordpress at all; there are quite a few hints you could research for your own stack.
Access logging can use a decent amount of CPU and disk IO for high traffic on spinning disks, you could try disabling it if it's a bottleneck. For a mostly static page, you could give nginx caching a try to reduce the load on fastcgi?
your ideal of "relevance" is entirely your creation. He literally ask for nginx conf review without providing any server configuration. At least I do not pretend to give answers to questions never asked.
It's no more than what WordPress actually uses when you run it. You should allocate 1gb RAM and 15gb HDD/SSD for an average WP install and Centmin only states that as a minimum for CentOS7. Based on my experience, the disk usage is LESS than the reqs they post and the RAM/CPU usage is minimal than if I were to install LAMP/WP manually.
It seems to me you decided to randomly pick a fight for no reasons at all and without really caring or contributing to the topic. Thank you for the free lesson about which pointers and hints could be relevant for a user saying they're new to nginx, and pretty unaware about what could be tweaked or twisted as well; even if this lesson wasn't asked for.
Your opinion and superior attitude has been appreciated and noted, have a good day! tips
if you mean help as in providing nonsense to questions than ok. OP asks for optimizing for a non existent site. WHAT OPTIMIZATION? I am sensible not to respond instead of giving useless info to a pointless question but for the sake of discussion and provide a rational retort to another user who at this point is pretending to a victim of a discussion forum.
Ohhh, a cat fight.
This is cool. Thanks!
needs more cowbell
FYI, though Centmin Mod min and recommended usage requirements for memory at least is dictated by CentOS's own requirements and recommendations i.e. CentOS 7 is 1GB.
Yup, try to deploy it and give a good look at it; even if you're not a CentOS person (I'm not) you can get some inspirations for your Debian deployment
Yeah I know a few folks who just follow/use Centmin Mod just to borrow ideas of more optimal configurations for their Ubuntu/Debian LEMP stack setups. The beauty of Centmin Mod being open source
@sudoranger biggest tip for optimal config, if you want to scale your wordpress install for concurrent user performance switch from unix sockets to TCP for PHP-FPM. You can see from my benchmarks for Centmin Mod vs EasyEngine v3 vs Webinoly vs VestaCP vs OneInStack at https://community.centminmod.com/threads/php-7-x-benchmarks-centmin-mod-vs-easyengine-vs-webinoly-vs-vestacp-vs-oneinstack.14988/ and how different LEMP stacks fair for PHP-FPM scalability performance especially where OneInStack falls behind when using PHP-FPM via unix sockets compared to other LEMP stacks using TCP at high concurrent user loads. You can jump straight to start of the scalability benchmarks here.
Also more ideas for your own Wordpress install configs seeing = Differences between Wordpress regular install vs centmin.sh menu option 22 install.
As some folks stated, even if you don't use Centmin Mod, you can borrow or see how stuff is implemented and do it yourself too i.e. https://centminmod.com/perf/. That's the benefits of open source projects.
https://cyberpanel.net/
it's ideal for WordPress, very easy to use, configure, and it has a plugin for WordPress for blazing fast performance. Tested, really nice thing.
Thanks for your suggestion but I'm currently not interested with any control panels (free or freemium or paid) but only looking to optimize and tweak my current nginx conf.
Thanks! I'll certainly going to check that out later tonight. I was a CentOS dude back in the cPanel days but since I got hook with Ubuntu's gnome lately so 90% of my systems are mostly debian-based (apart from Win10).
I have no idea what you said because my LEMP stack is straight-up sudo apt install php-fpm with no modification so perhaps it's using unix socket?
The site exists but the domain name isn't! Please read before assuming this as a pointless question.
How's the performance when it comes to at least 10K concurrent visitors?
Thanks! This is indeed a useful tip. Anymore (trusted/reliable) generators like this?
You can set the exact number of your cpu or cores here : worker_processes auto; . If you use 2 cores, then set worker_processes 2.