Skip to content

Instantly share code, notes, and snippets.

@temuri416
Created March 19, 2014 00:26

Revisions

  1. temuri416 created this gist Mar 19, 2014.
    64 changes: 64 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,64 @@
    server {
    listen 80;
    server_name fls.myhost.mobi;
    return 301 https://fls.myhost.mobi;
    }

    server {
    server_name fls.myhost.mobi;

    listen 443;
    ssl on;
    ssl_certificate /etc/ssl/myhost-mobi-ssl.crt;
    ssl_certificate_key /etc/ssl/myhost-mobi.key;

    access_log /var/log/fls.myhost-access-ssl.log;
    error_log /var/log/fls.myhost-error-ssl.log;

    set $root_path '/var/web/nginx/html/fls.myhost.mobi/public';
    set $baseURI '/';
    root $root_path;
    index index.php;

    location / {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;

    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto https;

    proxy_redirect off;
    try_files $uri $uri/ @php_mvc;
    }

    location @php_mvc {
    rewrite ^(.+)$ /index.php?_url=$1 last;
    }

    location ~ ^(.+\.php)(/.*)?$ {
    fastcgi_split_path_info ^(.+\.php)(/.*)?$;

    set $script_filename $document_root$fastcgi_script_name;

    if (!-e $script_filename) {
    return 404;
    }

    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    include fastcgi_params;

    fastcgi_param APPLICATION_ENV production;
    fastcgi_param SCRIPT_FILENAME $script_filename;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param BASEURI $baseURI;

    }
    location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
    root $root_path;
    }
    }