nginx ssl

SSL module is not enabled by default, use --with-http_ssl_module option to enable it:

./configure --with-http_ssl_module

make

make install

options for nginx command:

-c </path/to/config> Specify which configuration file Nginx should use instead of the default.
-g Set global directives. (version >=0.7.4)
-t Don't run, just test the configuration file. nginx checks configuration for correct syntax and then try to open files referred in configuration.
-s signal Send signal to a master process: stop, quit, reopen, reload. (version >= 0.7.53)
-v Print version.
-V Print nginx version, compiler version and configure parameters.
-p prefix Set prefix path (default: /usr/local/nginx/). (version >= 0.7.53)
-h,-? Print help.


Use this to stop nginx:

/usr/bin/nginx -s stop

Or:

kill -QUIT $( cat /usr/local/nginx/logs/nginx.pid )


Other signals as below:

TERM, INT Quick shutdown
QUIT Graceful shutdown
KILL Halts a stubborn process
HUP Configuration reload
Start the new worker processes with a new configuration
Gracefully shutdown the old worker processes
USR1 Reopen the log files
USR2 Upgrade Executable on the fly
WINCH Gracefully shutdown the worker processes

Generate SSL Certificate:

openssl genrsa -out xxx.pem 2048

openssl req -new -x509 -key xxx.pem -out cacert.pem -days 1095


Then edit the nginx.conf file:

    server {
        listen       443;
        server_name  localhost;


        ssl                  on;
        ssl_certificate      cacert.pem;
        ssl_certificate_key  xxx.pem;


        ssl_session_timeout  5m;


        ssl_protocols  SSLv2 SSLv3 TLSv1;
        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers   on;


        location / {
            root   html;
            index  index.html index.htm;
        }
    }


restart nginx server

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值