nginx搭建https环境

1、首先nginx必须支持ssl模块

./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module

2、配置server

server {

listen 443;

ssl on;

ssl_certificate /usr/local/cert/test.chained.crt;

ssl_certificate_key /usr/local/cert/test.seyouhui.cn.key;

server_name test.seyouhui.cn;

location / {

root /data/test;

index index.php index.html index.htm;

if (!-e $request_filename) {

rewrite ^(.*)$ /index.php?s=/$1 last;

break;

}

}

location ~ \.php$ {

root            html;

fastcgi_pass    127.0.0.1:9000;

fastcgi_index  index.php;

fastcgi_param  SCRIPT_FILENAME /data/test$fastcgi_script_name;

include        fastcgi_params;

}

}

你可能感兴趣的:(nginx搭建https环境)