Skip to content

Instantly share code, notes, and snippets.

@To-mos
Last active June 7, 2018 03:20
Show Gist options
  • Select an option

  • Save To-mos/7171d12fe2c4d36d2a2d10e35f314ff6 to your computer and use it in GitHub Desktop.

Select an option

Save To-mos/7171d12fe2c4d36d2a2d10e35f314ff6 to your computer and use it in GitHub Desktop.

Revisions

  1. To-mos revised this gist Dec 14, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WP and CI subfolders NGINX
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Begin HTTP Server
    server {
    listen 8080; # IPv4
    listen 80; # IPv4
    server_name localhost;

    ## Parametrization using hostname of access and log filenames.
  2. To-mos created this gist Dec 14, 2016.
    68 changes: 68 additions & 0 deletions WP and CI subfolders NGINX
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,68 @@
    # Begin HTTP Server
    server {
    listen 8080; # IPv4
    server_name localhost;

    ## Parametrization using hostname of access and log filenames.
    access_log logs/localhost_access.log;
    error_log logs/localhost_error.log;

    ## Root and index files.
    root html;
    index index.php index.html index.htm;

    ## If no favicon exists return a 204 (no content error).
    location = /favicon.ico {
    try_files $uri =204;
    log_not_found off;
    access_log off;
    }

    ## Don't log robots.txt requests.
    location = /robots.txt {
    allow all;
    log_not_found off;
    access_log off;
    }

    ## Try the requested URI as files before handling it to PHP.
    location / {

    ## Regular PHP processing.
    location ~ \.php$ {
    try_files $uri =404;
    fastcgi_pass php_processes;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    }

    ## Static files
    location ~* \.(?:css|gif|htc|ico|js|jpe?g|png|swf)$ {
    expires max;
    log_not_found off;
    ## No need to bleed constant updates. Send the all shebang in one
    ## fell swoop.
    tcp_nodelay off;
    ## Set the OS file cache.
    open_file_cache max=1000 inactive=120s;
    open_file_cache_valid 45s;
    open_file_cache_min_uses 2;
    open_file_cache_errors off;
    }

    ## Keep a tab on the 'big' static files.
    location ~* ^.+\.(?:ogg|pdf|pptx?)$ {
    expires 30d;
    ## No need to bleed constant updates. Send the all shebang in one
    ## fell swoop.
    tcp_nodelay off;
    }
    ## Route Codeigniter routes throgh index.php
    location /ci_project_folder {
    # Check if a file exists, or route it to index.php.
    try_files $uri $uri/ /ci_project_folder/index.php;
    }
    } # / location
    }
    # End HTTP Server