天天看点

Ubuntu下Nginx配置http与https不同页面

环境:Ubuntu 18 nginx 1.10

nginx在ubuntu的设置文件与centos不同,

而是在这里:

vi /etc/nginx/sites-available/default 
           

打开后写入内容:

server { # https
             listen 443 ssl;
             server_name example.com; # 证书的域名
             ssl_certificate /home/1_example.com_bundle.crt; # 证书地址
             ssl_certificate_key /home/2_example.com.key; # 证书地址
             ssl_session_timeout 5m;
             ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
             ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;             ssl_prefer_server_ciphers on;


             location / {
                  include uwsgi_params; # 是python写的web程序
                  uwsgi_pass 127.0.0.1:8006;
             }
        }

server {   # http
             listen 80;
             server_name localhost;
             location / {
                 root /var/www/html/; # http 的目录 这里是一个静态页面
                 autoindex on;
                 index index.html;
             }

       }

           

继续阅读