curl -fsSL https://gist.githubusercontent.com/muuvmuuv/7b7a911ddec2172375b75498154ce5e8/raw/2d2bef245f9644dae10f8724f784f3424c4e30a2/php-pm.sh | sh
More here: https://tideways.com/profiler/blog/an-introduction-to-php-fpm-tuning
- # download VIMAGE to a spare FreeBSD box | |
- unxz -T0 # uncompress | |
- mdconfig image.raw; mount # for editing | |
- sshd_enable | |
- devmatch_blacklist="virtio_random.ko" # avoid a bug | |
- PermitRootLogin | |
- /root/.ssh/authorized_keys | |
- umount; mdconfig -d | |
- xz -T0 -9 # compress edited image | |
- cp nginx/ # publish with any web server |
curl -fsSL https://gist.githubusercontent.com/muuvmuuv/7b7a911ddec2172375b75498154ce5e8/raw/2d2bef245f9644dae10f8724f784f3424c4e30a2/php-pm.sh | sh
More here: https://tideways.com/profiler/blog/an-introduction-to-php-fpm-tuning
In /etc/nginx/ I have a file called errors.conf, which should try and pass errors to a error.php file in /var/www/admin/public | |
---- | |
# Error handler, codes can also be combined | |
error_page 401 /error.php?c=401; | |
error_page 403 /error.php?c=403; | |
error_page 404 /error.php?c=404; | |
error_page 500 /error.php?c=500; | |
error_page 502 503 504 /error.php?c=50x; |
Source: https://www.cyberciti.biz/tips/linux-unix-bsd-nginx-webserver-security.html | |
This page collects hints how to improve the security of nginx web servers running on Linux or UNIX-like operating systems. | |
Default Config Files and Nginx Port | |
/usr/local/nginx/conf/ or /etc/nginx/– The nginx server configuration directory and /usr/local/nginx/conf/nginx.conf is main configuration file. | |
/usr/local/nginx/html/ or /var/www/html– The default document location. | |
/usr/local/nginx/logs/ or /var/log/nginx – The default log file location. | |
Nginx HTTP default port : TCP 80 |
server { | |
listen 80; | |
server_name site.mozilla.org; | |
location / { | |
return 301 https://$server_name$request_uri; | |
} | |
location /twohundredinator { | |
access_log off; |
#!/bin/bash | |
if curl --head -sf http://yourdomain.com/some-script.php -o /dev/null; then | |
echo "PHP FPM is up" | |
else | |
service php5-fpm restart && service nginx restart && service mysql restart | |
echo "Opps .. service was down" | mail -s "PHP-FPM Service Down" [email protected] -aFrom:[email protected] | |
fi |
/* http://meyerweb.com/eric/tools/css/reset/ | |
v2.0-modified | 20110126 | |
License: none (public domain) | |
*/ | |
html, body, div, span, applet, object, iframe, | |
h1, h2, h3, h4, h5, h6, p, blockquote, pre, | |
a, abbr, acronym, address, big, cite, code, | |
del, dfn, em, img, ins, kbd, q, s, samp, | |
small, strike, strong, sub, sup, tt, var, |
Example /etc/nginx/nginx.conf
using FastCGI (e.g. to PHP-FPM) with FastCGI cache enabled. This will capture returned data and persist it to a disk based cache store for a configurable amount of time, great for robust full page caching.
Will need to create a directory to hold cache files, for the example given here that would be:
$ sudo mkdir -p /var/cache/nginxfastcgi
$ chown www-data: /var/cache/nginxfastcgi
For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.
Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon
with HyperThreading enabled, but it can work without problem on slower machines.
You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.