server { listen 80 default_server; # listen 443 ssl; server_name _; # ssl_certificate /config/keys/cert.crt; # ssl_certificate_key /config/keys/cert.key; access_log /config/log/nginx/access.log; error_log /config/log/nginx/error.log; root /var/www/localhost/cops; index index.php; #Useful only for Kobo reader location /cops/ { rewrite ^/download/(\d+)/(\d+)/.*\.(.*)$ /fetch.php?data=$1&db=$2&type=$3 last; rewrite ^/download/(\d+)/.*\.(.*)$ /fetch.php?data=$1&type=$2 last; break; } #Can break loading the images - if you don't see anything, comment location ~ ^/images.*\.(gif|png|ico|jpg)$ { expires 31d; } #Can also break loading the images, comment if it happens location ~ .(js|css|eot|svg|woff|ttf)$ { expires 31d; } #Not necessarily correct, it depends on distro. location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; } location /books { root /; internal; } }