小程序部署步骤

此处以阿里云服务器为例:

申请阿里云服务器;
在阿里云服务器上安装nginx,做反向代理(映射);
nginx的配置如下:

 

#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;

    upstream tomcat_server{
    #server ht.shenghui56.com/ntocc_chauffeur_web;
    server 127.0.0.1;
    }
    server {
        listen       8078;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            proxy_pass   http://tomcat_server;
        
        }

        #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   tomcat_server;
       # }

        # 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 Apache's document root
        # concurs with nginx's 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;
    #server_name 101.132.152.185;
        server_name www.htoline.com;  # localhost修改为您证书绑定的域名。
    ssl on;   #设置为on启用SSL功能。
    ssl_certificate cert/2761253_htoline.com.pem;   #将domain name.pem替换成您证书的文件名。
    ssl_certificate_key cert/2761253_htoline.com.key;   #将domain name.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;   
    location / {
    #proxy_pass http://127.0.0.1:80;
    #proxy_pass 这个设置真实的调用接口,设置必需为ip。
    proxy_pass http://59.56.179.12:80;
    root   html;
 
    index index.html index.htm;
       proxy_set_header Host $host;
        proxy_set_header  X-Real-IP        $remote_addr;
        proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;

    }
    }

}

 

在conf目录下,新建cert文件夹,存放证书的两个文件;

在阿里云管理服务器上开发443入接口与nginx其余出入接口;ip配置为:0.0.0.0/0


2.在阿里云上申请证书。

证书的审核认证选择自动,将验证的名称 设置成创建的.txt文件的名称,内容为其验证的内容,放置1.中的阿里云服务器中的可访问路径下,可用.txt替换为tomcat的index页面。
点击审核认证通过的证书的nginx配置下载,按照提示进一步安装,即可。

在nignx的https server配置中,将证书内容安装相应配置进行配置,即可。

3.在微信公众平台,登录开发者管理对域名进行配置(一个月仅可配置5次)。
在小程序开发工具的设置中,将https校验开启,更换好域名后,重新提交代码,审核-发布,即可。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值