2008-06-20

配置安装nginx

关键字: nginx

配置安装nginx

1.下载nginx软件包: #wget http://sysoev.ru/nginx/nginx-0.6.8.tar.gz // 下载最新的版本 安装前还需要安装openssl
2. 解压后进入根文件夹 #./configure --with-http_ssl_module --without-http_rewrite_module
3.#make
4.#make install
5.修改nginx的配置文件,默认是放在/usr/local/nginx/conf/nginx.conf 存放html的根目录是/usr/local/nginx/html
6.启动nginx, #/usr/local/nginx/sbin/nginx
7.访问http://localhost/ 就可以看到默认的nginx自带的index.htm

如果要在nginx中配置ssl,首先要生成密钥对,注意,这里生成的密钥不是用ssh-keygen,而是用openssl,见https://dswork.vicp.net/prj/tech/wiki/webtech/openssl

http {
   ......
server {
        listen               443;
        ssl                  on;
        ssl_certificate      /usr/local/nginx/conf/ca.crt;
        ssl_certificate_key  /usr/local/nginx/conf/ca.key;
        keepalive_timeout    70;
        ...
    }
    ......
}
评论
发表评论

您还没有登录,请登录后发表评论