Nginx配置同一个域名http与https两种方式都可访问,证书是阿里云上免费申请的
server { listen 80; listen 443 ssl; ssl on; server_name 域名; index index.html index.htm index.php default.html default.htm default.php; ssl_certificate /usr/local/nginx/cert/21402058063066221.pem; //下载申请后阿里ssh提供的pem ssl_certificate_key /usr/local/nginx/cert/21402058063066221.key;//下载申请后阿里ssh提供的key ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; root /home/wwwroot/网站目录; include laravel.conf; //好吧,这里是laravel配置,不一定合适您哈,请或略 #error_page 404 /404.html; include enable-php.conf; location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } access_log /home/wwwlogs/airclass.mime.org.cn.log; }