Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've installed nginx and transfer my server over to nginx (from apache). I made a subdomain which has SSL. My http:// works perfect.. But when I access https://secure.gamegambit.com it starts to download file. Yet any other url with https:// works fine such as https://secure.gamegambit.com/gamegambit-wiki.html

nginx default config:

server {
listen 443;
server_name secure.gamegambit.com;
root /var/www/;
index index.php index.html index.htm default.html default.htm;

ssl on;
ssl_certificate /root/gamegambit.crt;
ssl_certificate_key /root/gamegambit.key;
ssl_client_certificate /root/gs_intermediate_ca.crt;

ssl_session_timeout 5m;

ssl_protocols SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
ssl_prefer_server_ciphers on;

## Default location
location / {
    try_files $uri $uri/ /index.php?q=$request_uri;

}

location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
  access_log        off;
  expires           30d;
  root /var/www/;
}
    location ~ .*.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
 location ~ /.ht {
    deny  all;
    }
 location ~ /.git {
    deny  all;
 }
    location ~ /.svn {
        deny  all;
 }
location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
            return 403;
            error_page 403 /403_error.html;
    }
# caching of files 
    location ~* \.(ico|pdf|flv)$ {
            expires 1y;
    }
location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
            expires 14d;
    }
}

My /etc/nginx/fastcgi_params

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param SERVER_PROTOCOL $server_protocol; 
fastcgi_param SCRIPT_NAME $fastcgi_script_name; 
fastcgi_param PATH_INFO $fastcgi_script_name; 
fastcgi_param REQUEST_URI $request_uri; 
fastcgi_param DOCUMENT_URI $document_uri; 
fastcgi_param DOCUMENT_ROOT $document_root; 
fastcgi_param REMOTE_ADDR $remote_addr; 
fastcgi_param REMOTE_PORT $remote_port; 
fastcgi_param SERVER_ADDR $server_addr; 
fastcgi_param SERVER_PORT $server_port; 
fastcgi_param SERVER_NAME $server_name; 
fastcgi_param QUERY_STRING $query_string; 
fastcgi_param REQUEST_METHOD $request_method; 
fastcgi_param CONTENT_TYPE $content_type; 
fastcgi_param CONTENT_LENGTH $content_length; 
fastcgi_param REDIRECT_STATUS 200;
share|improve this question
    
I suggest you turning debug to see what does the error log say. Also use location ~ \.php$ for more exact. –  quanta Oct 16 '11 at 10:08
add comment

1 Answer 1

The location directive for php files should be like the following:

location ~ \.php$
{
   ...
}

Have a look t this tutorial for the full setup details and configuration settings:

http://www.idolbin.com/blog/server-management/vps-setup-guide/enable-https-httpssl-in-nginx-web-server/

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.