Skip to content

nginx configuration

Mic92 edited this page Mar 30, 2013 · 10 revisions

nginx configuration

an example nginx configuration (thanks Mic92). See also https://gist.github.com/4091461

    upstream backend {
       server unix:/var/run/php-fpm.sock;
    }
    server {
        listen [::]:80;
        listen [::]:443 ssl;
        server_name rss.yourdomain.com;
        root /var/www/selfoss/;
        access_log /var/log/nginx/rss.access.log;
        error_log /var/log/nginx/rss.error.log;
        location ~* \ (gif|jpg|png) {
          expires 30d;
        }
        location ~ ^/favicons/.*$ {
            try_files $uri /data/$uri;
        }
        
        location ~* ^/(data\/logs|data\/sqlite|config\.ini|\.ht) {
            deny all;
        }
        location / {
          index index.php index.html index.htm;
          try_files $uri /public/$uri /index.php$is_args$args;
        }
        location ~ \.php$ {
          fastcgi_pass backend;
          fastcgi_index index.php;
          fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
          include fastcgi_params;
        }
    }