Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7450515
  • 博文数量: 1760
  • 博客积分: 18684
  • 博客等级: 上将
  • 技术积分: 16267
  • 用 户 组: 普通用户
  • 注册时间: 2010-06-02 10:28
个人简介

啥也没写

文章分类

全部博文(1760)

文章存档

2024年(6)

2023年(44)

2022年(39)

2021年(46)

2020年(43)

2019年(27)

2018年(44)

2017年(50)

2016年(47)

2015年(15)

2014年(21)

2013年(43)

2012年(143)

2011年(228)

2010年(263)

2009年(384)

2008年(246)

2007年(30)

2006年(38)

2005年(2)

2004年(1)

分类: LINUX

2009-05-08 09:48:39

安装nginx之前先安装 openssl 和 openssl-devel
编译nginx时使用 --with-http_ssl_module 就可以支持SSL了

然后需要生成服务器证书,没钱就用openssl自己作一个

   openssl req -new -x509 -nodes -out eglic.crt -keyout eglic.key

增加一个虚拟主机

server {
 listen 443;
 ssl on;
 ssl_certificate  /opt/eglic.crt;
 ssl_certificate_key /opt/eglic.key;
 server_name  ;
        charset gb2312;
 index  index.php index.html index.htm;
 root   /var/www/eglic;
 location / {
  index  index.php index.html index.htm;
  rewrite ^/show-([0-9]+)-([0-9]+)\.html$ /index.php?action=show&id=$1&page=$2 last;
  rewrite ^/category-([0-9]+)-([0-9]+)\.html$ /index.php?action=index&cid=$1&page=$2 last;
  rewrite ^/archives-([0-9]+)-([0-9]+)\.html$ /index.php?action=index&setdate=$1&page=$2 last;
  rewrite ^/(archives|search|reg|login|index|links)\.html$ /index.php?action=$1 last;
  rewrite ^/(comments|tagslist|trackbacks|index)-([0-9]+)\.html$ /index.php?action=$1&page=$2 last;
 }
 location ~ .*\.php?$
 {
  fastcgi_pass   127.0.0.1:10086;
  fastcgi_index  index.php;
  fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_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  SCRIPT_NAME        $fastcgi_script_name;
  fastcgi_param  REQUEST_URI        $request_uri;
  fastcgi_param  DOCUMENT_URI       $document_uri;
  fastcgi_param  DOCUMENT_ROOT      $document_root;
  fastcgi_param  SERVER_PROTOCOL    $server_protocol;
  fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
  fastcgi_param  SERVER_SOFTWARE    eglic/$nginx_version;
  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  REDIRECT_STATUS    200;
 }
}


现在可以通过 访问了!

 

阅读(620) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~