Skip to content

Instantly share code, notes, and snippets.

@sergeifilippov
Created February 10, 2014 03:22
Show Gist options
  • Save sergeifilippov/8909839 to your computer and use it in GitHub Desktop.
Save sergeifilippov/8909839 to your computer and use it in GitHub Desktop.

Revisions

  1. sergeifilippov created this gist Feb 10, 2014.
    34 changes: 34 additions & 0 deletions domain-nginx.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    server {
    server_name $domain_name;
    root /var/www;
    index index.html index.php;
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    # Cache static files for as long as possible
    location ~* \.(?:xml|ogg|mp3|mp4|ogv|svg|svgz|eot|otf|woff|ttf|css|js|jpg|jpeg|gif|png|ico)$ {
    try_files $uri =404;
    expires max;
    access_log off;
    add_header Pragma public;
    add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    }

    # if hosting in a sub folder, setup a new location
    # replace `/linus-dash` with the folder name eg. `/folder_name`
    #location /linux-dash {
    # index index.html index.php;
    #}

    # Pass PHP requests on to PHP-FPM using sockets
    location ~ \.php(/|$) {
    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    fastcgi_pass unix:/run/php5-fpm.sock;
    # fastcgi_pass localhost:9000; # using TCP/IP stack
    if (!-f $document_root$fastcgi_script_name) {
    return 404;
    }
    try_files $uri $uri/ /index.php?$args;
    include fastcgi_params;
    }
    }
    9 changes: 9 additions & 0 deletions wiki.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    ## Dependecies

    + nginx
    + php-fpm
    + php5-curl

    1. Install `php-fpm` and configura to use either `sockets` or `TCP/IP`

    2. Create a nginx configuration (`eg. domain_name.conf`) in `/etc/nginx/conf.d/`