CentOS 配置范例

发布时间:2015/1/16 22:52:04 打印 字号:

目录位置:/alidata/server/nginx-1.4.4/conf/vhosts

server {

listen       443 ssl;

server_name  localhost;

ssl          on;

ssl_certificate /alidata/server/nginx-1.4.4/conf/vhosts/www.gworg.com.pem;

ssl_certificate_key /alidata/server/nginx-1.4.4/conf/vhosts/www.gworg.com.key;

ssl_session_cache    shared:SSL:1m;

ssl_session_timeout  5m;

ssl_ciphers  HIGH:!aNULL:!MD5;

ssl_prefer_server_ciphers  on;        

location / {

root /alidata/www/default;

index  index.html index.htm hello.php index.php;

        }

location ~ .*\.(php|php5)?$ {

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$

{

expires 30d;

}

location ~ .*\.(js|css)?$

{

expires 1h;

}

root /alidata/www/default;

fastcgi_pass   127.0.0.1:9000;

fastcgi_index  index.php;

fastcgi_param  HTTPS   on;

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;

include        fastcgi_params;

#new line

include fastcgi.conf; 

            

        }

    }






server {

        listen       80;

        server_name  www.gworg.com; 

        rewrite ^(.*)$ https://$server_name$1 permanent; 

index index.html index.htm index.php;

root /alidata/www/default;

location ~ .*\.(php|php5)?$

{

#fastcgi_pass  unix:/tmp/php-cgi.sock;

fastcgi_pass  127.0.0.1:9000;

fastcgi_index index.php;

include fastcgi.conf;

}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$

{

expires 30d;

}

location ~ .*\.(js|css)?$

{

expires 1h;

}

#伪静态规则

include /alidata/server/nginx/conf/rewrite/default.conf;

access_log  /alidata/log/nginx/access/default.log;

}