nginx 可以与 SSL 一起使用吗?我正在使用http://nginxcp.com/对于我的 CPanel 服务器,这是我的配置文件设置
server {
error_log /var/log/nginx/vhost-error_log warn;
listen 1.2.3.4:80;
server_name domina.org www.domina.org domina2.info www.domina2.info;
access_log /usr/local/apache/domlogs/domina.org-bytes_log bytes_log;
access_log /usr/local/apache/domlogs/domina.org combined;
root /home/domina/public_html;
location / {
location ~.*\.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|html|htm|txt|js|css|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso)$ {
expires 7d;
try_files $uri @backend;
}
error_page 405 = @backend;
add_header X-Cache "HIT from Backend";
proxy_pass http://1.2.3.4:8081;
include proxy.inc;
}
location @backend {
internal;
proxy_pass http://1.2.3.4:8081;
include proxy.inc;
}
location ~ .*\.(php|jsp|cgi|pl|py)?$ {
proxy_pass http://1.2.3.4:8081;
include proxy.inc;
}
location ~ /\.ht {
deny all;
}
}
如何添加 SSL?
答案1
Nginx 当然可以处理 HTTPS 请求!
server {
listen 443;
server_name secure.mydomain.com;
ssl on;
ssl_certificate /home/mydomain/conf/cert/chained_mydomain.crt;
ssl_certificate_key /home/mydomain/conf/cert/private_unlocked.pem;
keepalive_timeout 50;
}
以下是有关 HttpSSL 模块的官方文档:http://wiki.nginx.org/HttpSslModule