window下nginx配置https 443端口
服务器首先安全组要开放443端口,然后在腾讯云下载ssl证书(由于我的云服务器是腾讯云,阿里云或其他的话应该也有,我就不用那个openssl那个软件生成ssl证书了),
我用的nginx版本如图所示
nginx.conf配置文件如下所示
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main $remote_addr - $remote_user [$time_local] "$request" # $status $body_bytes_sent "$http_referer" # "$http_user_agent" "$http_x_forwarded_for"; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; #server { #listen 80; #server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; #location / { # root html; # index index.html index.htm; #} #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # #error_page 500 502 503 504 /50x.html; #location = /50x.html { # root html; #} # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ .php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ .php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apaches document root # concurs with nginxs one # #location ~ /.ht { # deny all; #} #} # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # server { listen 443 ssl; server_name baidu.com; ssl_certificate ./1_baidu.com_bundle.crt; #这里是ssl key文件存放的绝对路径,根据自己的文件名称和路径来写 ssl_certificate_key ./2_baidu.com.key; #这里是ssl key文件存放的绝对路径,根据自己的文件名称和路径来写 ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; location / { proxy_pass http://baidu.com:80/; } } }
主要是这四行
第二行和第三行的.crt和.key文件我直接放在nginx目录下了。
上一篇:
通过多线程提高代码的执行效率例子
下一篇:
二分查找的两种方法(详细图解)