Skip to content

Instantly share code, notes, and snippets.

Created September 29, 2014 06:51

Revisions

  1. @invalid-email-address Anonymous created this gist Sep 29, 2014.
    85 changes: 85 additions & 0 deletions default.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,85 @@
    server {
    listen 80;
    server_name bitcall.org;
    root /usr/share/nginx/html;
    #charset koi8-r;
    # access_log /var/log/nginx/log/host.access.log main;
    if (!-e $request_filename) {
    rewrite ^([_0-9a-zA-Z-]+)?(/wp-.*) $2 last;
    rewrite ^([_0-9a-zA-Z-]+)?(/.*.php)$ $2 last;
    rewrite ^ /index.php last;
    }

    location / {
    # root /usr/share/nginx/html;
    index index.php index.html index.htm;
    #if (-f $request_filename/index.html){
    # rewrite (.*) $1/index.html break;
    #}

    location ~ /\.
    {
    deny all;
    }

    #if (-f $request_filename/index.php){
    # rewrite (.*) $1/index.php;
    #}

    #if (!-f $request_filename){
    # rewrite (.*) /index.php;
    #}
    #rewrite /wp-admin$ $scheme://$host$uri/ permanent;

    }

    # enforce NO www
    # if ($host ~* ^www\.(.*))
    #{
    # set $host_without_www $1;
    # rewrite ^/(.*)$ $scheme://$host_without_www/$1 permanent;
    #}

    # unless the request is for a valid file, send to bootstrap
    # if (!-e $request_filename)
    # {
    # rewrite ^(.+)$ /index.php?q=$1 last;
    # }

    error_page 404 /404.html;

    # redirect server error pages to the static page /50x.html
    #
    #include wp.conf;

    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    root /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    # proxy_pass http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
    root /usr/share/nginx/html;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    #$document_root$fastcgi_script_name;
    include fastcgi_params;
    }
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    # deny all;
    #}
    }