Skip to content

Instantly share code, notes, and snippets.

@asha23
Created October 28, 2019 10:04
Show Gist options
  • Save asha23/6d4a8e7ce5962d5aef5245b9ff874a63 to your computer and use it in GitHub Desktop.
Save asha23/6d4a8e7ce5962d5aef5245b9ff874a63 to your computer and use it in GitHub Desktop.

Revisions

  1. asha23 created this gist Oct 28, 2019.
    57 changes: 57 additions & 0 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,57 @@
    server {
    listen 80;
    listen 443 ssl http2;
    server_name .test.test;
    root "/home/vagrant/code/test";

    index index.php index.html index.htm;

    charset utf-8;



    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt { allow all; access_log off; log_not_found off; }

    location ~ /.*\.(jpg|jpeg|png|js|css)$ {
    try_files $uri =404;
    }

    location / {
    try_files $uri $uri/ /index.php?$args;
    }

    if (!-e $request_filename) {
    # Add trailing slash to */wp-admin requests.
    # rewrite /wp-admin$ $scheme://$host$uri/ permanent;
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;
    rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
    rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
    }


    location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    include fastcgi_params;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    fastcgi_intercept_errors on;
    fastcgi_buffers 16 16k;
    fastcgi_buffer_size 32k;
    }

    access_log off;
    error_log /var/log/nginx/test.log error;

    sendfile off;

    client_max_body_size 100m;

    location ~ /\.ht {
    deny all;
    }

    ssl_certificate /etc/nginx/ssl/test.test.crt;
    ssl_certificate_key /etc/nginx/ssl/test.test.key;
    }