阿里云域名前加上https
然后在配置小程序服务器的时候,需要使用https而不是http,注意https为ssl加密的协议。
如果是使用的阿里云,需要在阿里云服务中选择ssl服务, 下载nginx对应证书:
在/etc/nginx 目录下面创建cert目录,将ssl证书下载后放置过去
并且修改后缀pem为crt
阿里云控制台=》云计算基础服务=》云服务器ECS=》网络和安全=》安全组,没有安全组的创建一个安全组,有的直接选择相应安全组,点击配置规则=》添加安全组规则(把80端口和443端口添加进安全组,授权对象填0.0.0.0/0)
然后修改nginx配置
|
# For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ worker_processes auto; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic. include /usr/share/nginx/modules/*.conf;
events { worker_connections 1024; }
http { 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 /var/log/nginx/access.log main;
sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information.
upstream django { #server unix:///path/to/your/mysite/mysite.sock; # ʹÓÃunixÌ×½Ó×Ö server 127.0.0.1:8081; # ʹÓÃTCP¶Ë¿ÚÇë×¢ÊÍÉÏÒ»ÐУ¬²¢È¡Ïû±¾ÐÐ×¢ÊÍ£¬ÕâÀïµÄ¶Ë¿ÚÖ¸µÄÊÇÅÜuwsgiµÄ¶Ë¿Ú #±ØÐëºÍuwsgiÖеÄÉèÖÃÒ» } server { listen 80; listen 443 ssl default_server; ssl on; ssl_certificate /etc/nginx/cert/1861464_www.chufangofbx.com.crt; ssl_certificate_key /etc/nginx/cert/1861464_www.chufangofbx.com.key; #listen 80 default_server; server_name www.chufangofbx.com; root /usr/share/nginx/html; include /etc/nginx/default.d/*.conf;
proxy_connect_timeout 600; proxy_read_timeout 600; proxy_send_timeout 600;
location / { include /etc/nginx/uwsgi_params; uwsgi_pass django; } }
include /etc/nginx/conf.d/*.conf; proxy_read_timeout 1800; proxy_send_timeout 1800; }
|
service nginx restart
浙公网安备 33010602011771号