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;
}
}