View Single Post
Old 09-20-2012, 11:40 PM   #118
trogdan
Junior Member
trogdan began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Aug 2012
Device: Android
Trying to place COPS in a subfolder

So, I am new to nginx and PHP. I'm trying to place COPS in a subdirectory. So for example, instead of

http://hostname/index.php

I would like to have

http://hostname/opds/index.php

Anyone have suggestions to change my configuration to allow this? If i just change the root , the php doesn't get executed, it's merely downloaded by the client.

Code:
server {

    	listen [::]:443;
	server_name www.domain.com;
    	
	ssl on;
	ssl_certificate /etc/nginx/conf.d/server.crt;
	ssl_certificate_key /etc/nginx/conf.d/server.pem;
	ssl_session_timeout 5m;

    	access_log  /var/log/nginx/server.access.log;
    	error_log /var/log/nginx/server.error.log;
    	root   /var/www/opds;
    	
    	location /download/ {
		rewrite ^/download/(\d+)/.*\.(.*)$ /fetch.php?data=$1&type=$2 last;
      		break;
    	}

    	location ~ ^/images.*\.(gif|png|ico|jpg)$ {
		expires 31d;
    	}

    	location ~ .(js|css)$ {
		expires 31d;
    	}
    
    	location ~ .*\.php$ {
		include /etc/nginx/fastcgi_params;
       		fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;
       		fastcgi_pass 127.0.0.1:9000;
    	}

    	location /Calibre {
		root /media/Quadra/Books;
		internal;
    	}	
}
trogdan is offline   Reply With Quote