background preloader

How To Optimize Nginx Configuration

How To Optimize Nginx Configuration

Optimizing servers - nginx speedup & optimization guide nginx is a small and fast webserver which generally outperforms most of the alternatives out of the box, however there is always room for improvement. In addition to operating as a web-server nginx can also be used as reverse HTTP proxy, forwarding requests it recieves to different back-end servers. General Tuning nginx uses a fixed number of workers, each of which handles incoming requests. The general rule of thumb is that you should have one worker for each CPU-core your server contains. You can count the CPUs available to your system by running: $ grep ^processor /proc/cpuinfo | wc -l With a quad-core processor this would give you a configuration that started like so: # One worker per CPU-core. worker_processes 4; events { worker_connections 8096; multi_accept on; use epoll; } worker_rlimit_nofile 40000; http { sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 15; # Your content here .. } The maximum number of connections your server can process is the result of: Compression

Basic Linux Commands Basic Linux Commands mkdir - make directories Usage mkdir [OPTION] DIRECTORY Options Create the DIRECTORY(ies), if they do not already exist. Mandatory arguments to long options are mandatory for short options too. -m, mode=MODE set permission mode (as in chmod), not rwxrwxrwx - umask -p, parents no error if existing, make parent directories as needed -v, verbose print a message for each created directory -help display this help and exit -version output version information and exit cd - change directories Use cd to change directories. mv- change the name of a directory Type mv followed by the current name of a directory and the new name of the directory. Ex: mv testdir newnamedir pwd - print working directory will show you the full path to the directory you are currently in. rmdir - Remove an existing directory rm -r Removes directories and files within the directories recursively. chown - change file owner and group chown [OPTION] OWNER[:[GROUP]] FILE chown [OPTION] :GROUP FILE u - User who owns the file. bg

SSL Certificates with Nginx Updated by Alex Fornuto Transport Layer Security (TLS) and Secure Socket Layer (SSL) provide an easy method to encrypt connections between end-users and web servers. SSL uses a certificate authority system to provide identity verification in order to prevent websites from falsely claiming to be another organization or website. This guide outlines how to provide encrypted access to resources using SSL certificates and nginx. This document assumes that you have completed the getting started guide. Install Nginx With SSL Support Before proceeding, ensure that you’ve compiled nginx with support for SSL. If you compiled nginx from source code obtained from the upstream, ensure that the --with-http_ssl_module argument is added to the . Create and Manage SSL Certificates Before configuring nginx to use SSL, you must generate SSL certificates. These examples store the SSL certificate in the /srv/ssl/ directory. Generate a Self Signed Certificate nginx.conf Optimizing Nginx For SSL More Information

How To Install and Setup Postfix on Ubuntu 14.04 Introduction Postfix is a very popular open source Mail Transfer Agent (MTA) that can be used to route and deliver email on a Linux system. It is estimated that around 25% of public mail servers on the internet run Postfix. In this guide, we'll teach you how to get up and running quickly with Postfix on an Ubuntu 14.04 server. Prerequisites In order to follow this guide, you should have a Fully Qualified Domain Name pointed at your Ubuntu 14.04 server. Install the Software The installation process of Postfix on Ubuntu 14.04 is easy because the software is in Ubuntu's default package repositories. Since this is our first operation with apt in this session, we're going to update our local package index and then install the Postfix package: sudo apt-get update sudo apt-get install postfix You will be asked what type of mail configuration you want to have for your server. Next, you will be asked for the Fully Qualified Domain Name (FQDN) for your server. example.com Configure Postfix mail Conclusion

Configure NGINX virtual server for various PHP Frameworks A portable, preconfigured, lightweight, fast and stable server stack for developing php mysql applications on windows, based on the excellent webserver Nginx. A lighter alternative to XAMPP and WAMP. In the WTServer Manager window, go to Project Setup, check Enable Local Virtual Server, then Save. Edit WTServer\conf\domains.d\projectName.conf directly or go to Project Setup and click on Edit Nginx Local Virtual Server Configuration File icon. Anchor Nginx configuration: location / { try_files $uri $uri/ /index.php; } Bolt Nginx configuration: CakePHP Nginx configuration: location / { try_files $uri $uri/ /index.php? CodeIgniter Nginx configuration: location / { # Check if a file or directory index file exists, else route it to index.php. try_files $uri $uri/ /index.php; } Drupal Nginx configuration: # This matters if you use drush location = /backup { deny all; } ## Very rarely should these ever be accessed outside of your lan location ~* \. Joomla Nginx configuration: Laravel Nginx configuration:

Linux Commands Cheat Sheet in Black & White Keep this linux cheat sheet on your desk printed, I am sure you will learn them quick and will be a linux expert very soon. We have added had both pdf and image (png) format of the cheat sheet. Please keep us posted if you need us to add more commands. We have grouped commands in the below categories a) System b) Hardware c) Users d) File Commands e) Process Related f) File Permission g) Network h) Compression / Archives i) Install Packages j) Install Source k) Search l) Login m) File Transfer n) Directory Traverse Download linux cheat sheet in pdf format and refer each command in detail. Filed Under : LINUX COMMANDS

Desktop Ubuntu in Amazon EC2 - The Right Way Thursday, 2nd December 2010 - 22 Comments Recently I have had to run a Java app on a server which required a GUI front-end to operate. The majority of my experience with servers in "the cloud" has been via command line SSH connection. For this I tend to use the latest LTS release of Ubuntu Server. Ubuntu Server by design is lean and mean, not possessing any native GUI capabilities and hence I needed to find an alternative. I will be using Amazon EC2 for this demonstration. Connecting to the desktop instance will require a means of sending over the X-Windows screen. AMI Installation The first task is to launch the instance using the Community AMI with code ami-9f8573f6. Open up the EC2 management console window and select Launch Instance. Click on Community AMIs and then type in ami-9f8573f6 to the right of the All Images dropdown menu. The next screen allows you to determine the quantity, type and location of the instance(s) you wish to launch. Server Configuration chmod 400 keypair.pem

MailServer Introduction Setting up an email server is a difficult process involving a number of different programs, each of which needs to be properly configured. The best approach is to install and configure each individual component one by one, ensuring that each one works, and gradually build your mail server. Mail Transfer Agent A Mail Transfer Agent (MTA) is the program which receives and sends out the email from your server, and is therefore the key part. Postfix - this guide explains how to set up Postfix. Mail filtering You can add filtering in your mail chain, mainly in order to detect spam and viruses. PostfixAmavisNew - this guide explains how to integrate amavisd-new with Postfix. Mail Delivery Agent In order to allow you or others to download email from other locations, you need to setup an IMAP or POP3 server. Dovecot - this guide explains how to set up Dovecot as a mail server. Webmail Squirrelmail - this guide explains how to set up Squirrelmail webmail. Mailing lists

How To Fix 504 Gateway Time-out on Nginx - idroot If you run a Nginx web server you may have already encountered the annoying 504 Gateway Time-out errors. This is pretty common error, are generated most probably by the PHP max execution time limit or by the FastCGI read timeout settings. This tutorial shows you how to fix nginx 504 gateway timeout on the nginx webserver. Changes in php.ini Try raising max_execution_time setting in php.ini file (CentOS path is /etc/php.ini): Changes in PHP-FPM Try raising request_terminate_timeout setting in php.ini file (CentOS path is /etc/php-fpm.d): request_terminate_timeout = 150 Changes in Nginx Config Finally, add fastcgi_read_timeout variable inside our Nginx virtual host configuration: Reload PHP-FPM and Nginx service php-fpm restart service nginx restart Congratulation’s! Nginx Manage Service Offer If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “Nginx Manage Service Offer”, starting from $10 (Paypal payment).

Linux Command Line Cheat Sheet by DaveChild - Download free from Cheatography - Cheatography.com: Cheat Sheets For Every Occasion A cheat sheet of the commands I use most for Linux, with popup links to man pages. bash nano linux ls commandline ubuntu server sysadmin shell Download the Linux Command Line Cheat Sheet 2 Pages Like this cheat sheet? Readable.io is a collection of tools to make your writing better. Click Here To Get Started!

Related: