HTTPS 和 HTTP 的區別:html
HTTPS = HTTP + SSL,也就是HTTP加密的增強版。因爲HTTP協議在通過路由器會被其餘人劫持,由此會致使數據泄露、篡改,通常金融電商等涉及交易的網站都應該有https加密。node
nginx 安裝與配置(見下文)nginx
ssl證書:能夠自行生成,或者由安所有門提供git
sudo apt-get install nginx
sudo vim /etc/nginx/sites-available/default
下面是相應的配置文件github
upstream shiny-server{ server 127.0.0.1:3838; }# 反向代理shiny 或者你本身的服務器端口 server { listen 443 ssl; # 經過443綁定ssl listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; index index.html index.htm; ssl_session_cache shared:SSL:1m; # 從管理員提供的加密方法與配置 ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; ssl on; ssl_certificate /home/financer/.ssh/_.financer.crt; # 從管理員提供的證書 ssl_certificate_key /home/financer/.ssh/_.financer.key; # Make site accessible from http://localhost/ #server_name localhost; server_name 192.168.1.1;# 填寫本機IP access_log /var/log/nginx/shiny-server; # proxy location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; "/etc/nginx/sites-available/default" [readonly] 141L, 3364C 1,1 Top proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; # proxy address proxy_pass http://shiny-server; proxy_redirect off; }
而後再重啓nginx來激活配置web
sudo service nginx restart
訪問 https://localhost
將會看到 shiny 的默認頁面。vim
https的用處安全
配置nginx服務器
如何配置nginx 反向代理session