Nginx full configration with best performance

Created at: 2019-08-14 06:14:16 Updated at: 2019-08-14 09:58:55

in Linux, Nginx, Web server

NGINX Tuning For Best Performance

This post assume that you are linux user and logged as root user.

This post is wrriten by mearginging many configuration files at once so you may find same configuration at nginx official websiteas well.

Nginx tune up are dived into two major part

  1. Nginx main configuration file called as nginx.conf
  2. Another one is called as virtual host file wich located in eather conf.d directory or sites-enable folder based on linux flavour.

Backup your original configs and you can start reconfigure your configs. You will need to open your nginx.conf at /etc/nginx/nginx.co...

Nginx minimal configuration

Created at: 2019-08-14 05:56:53 Updated at: 2019-08-14 06:30:49

in Linux, Nginx, Web server

Basic nginx configuration for with php-fpm as reverse proxy


# redirect all http traffic to https
server {
    # Listen port 80 at ipv4 and ipv6
    listen 80;
    listen [::]:80;

    # server name would be your server FQDN or dns host name or ip address seperated by space
    server_name example.com;

    return 301 https://$host$request_uri;
}

server {

    # Listen port 443 at ipv4 and ipv6
    listen 443 ssl;
    listen [::]:443 ssl;

    # server name would be your server FQDN or dns host name or ip address seperated by space
    server_name example.com;

    root /var/www/html;

    ad...

Htaccess file for any project

Created at: 2019-08-12 16:51:35 Updated at: 2019-08-13 11:03:00

in Apache

Quick , Easy and Fast .htaccess for any kind of project.

    RewriteEngine On
    # The following rule tells Apache that if the requested filename
    # exists, simply serve it.
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    # The following rewrites all other queries to index.php. The
    # condition ensures that if you are using Apache aliases to do
    # mass virtual hosting, the base path will be prepended to
    # allow proper resolution of the index.php file; it will work
    ...