http://wiki.nginx.org/Modules#Standard_HTTP_modules 这里面带有所有基本的模块,及需要额外增加的模块
1.安装带有ssl模块的 nginx
- wget http://nginx.org/download/nginx-0.8.52.tar.gz
- tar zxvf nginx-0.8.52.tar.gz
- chown root:root nginx-0.8.52 -R
- apt-get install libpcre3 libpcre3-dev
- apt-get install openssl
- apt-get install libssl-dev
- ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module
- make
- make install
2.配置nginx 配置文件
- ssl on;
- ssl_certificate /etc/nginx/nginx_pas/*.crt;
- ssl_certificate_key /etc/nginx/nginx_pas/*.key;
启动nginx提示:error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory,意思是找不到libpcre.so.1这个模块,而导致启动失败。
[root@lee ~]# /usr/local/webserver/nginx/sbin/nginx nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
经过搜索资料,发现部分linux系统存有的通病。要解决这个方法非常容易
如果是32位系统
[root@lee ~]# ln -s /usr/local/lib/libpcre.so.1 /lib
如果是64位系统
[root@lee ~]# ln -s /usr/local/lib/libpcre.so.1 /lib64
然后在启动nginx就OK了
[root@lee ~]# /usr/local/webserver/nginx/sbin/nginx
3. 配置nginx的conf ,所有都要求访问https
[html] view plain copy
- location / {
- rewrite ^/(.*) https://*.com/$1 permanent ;
- #root /var/www/nginx-default;
- #index index.html index.htm;
- }