server{
listen 80;
listen 443 ssl;
ssl_certificate /usr/local/nginx/ssl/www.demo.com/www.demo.com.cn-ca-bundle.crt;#############ssl证书
ssl_certificate_key /usr/local/nginx/ssl/www.demo.comwww.demo.com.key;############ssl证书key
autoindex on;
#开启读取非nginx标准的用户自定义header(开启header的下划线支持)
underscores_in_headers on;
server_namewww.demo.com;
access_log /usr/local/nginx/logs/access.log combined;
index index.html index.htm index.jsp index.php;
#error_page 404 /404.html;
location / {
proxy_pass https://www.demo.com:8080;
add_header Access-Control-Allow-Origin *;
}
}
如果未开启ssl模块,配置https时将会提示错误:
nginx:[emerg] the 'ssl' parmeter requires ngx_http_ssl_module in /usr/local/conf/xxx.conf :37
这是因为nginx缺少http_ssl_module模块,编译安装时候带上--with-http_ssl_module配置就行了,如果nginx已经安装了怎么办?
看下面教程:
nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in ......(http://www.cnblogs.com/kenwar/p/8295907.html)