Table of Contents
启动项目
配置Nginx
测试项目
结语
Home WeChat Applet Mini Program Development Teach you step by step how to deploy WeChat applet and go online

Teach you step by step how to deploy WeChat applet and go online

Dec 03, 2021 am 10:18 AM
WeChat applet

怎么部署微信小程序并上线?下面本篇文章分享一个部署微信小程序的过程并上线微信小程序,希望对大家有所帮助!

Teach you step by step how to deploy WeChat applet and go online

今天将简单介绍将项目部署到服务器中,并将前端代码提交到微信待审核。下面直接开始正题。 

启动项目

  后端基于SpringBoot的微信小程序服务的所有接口已经开发完成,那么现在开始将服务部署到云服务器中,登录服务器。

Teach you step by step how to deploy WeChat applet and go online

使用Maven将项目打包完成,

Teach you step by step how to deploy WeChat applet and go online

将项目的文件打包上传到服务器中

Teach you step by step how to deploy WeChat applet and go online

  通过命令 ls 可以看到已经将文件上传到服务器了。使用命令:java -jar BootWxTool-0.0.1-SNAPSHOT.jar 启动Spring Boot项目。启动过程如下图。

java -jar BootWxTool-0.0.1-SNAPSHOT.jar
Copy after login

Teach you step by step how to deploy WeChat applet and go online

  项目启动完成之后,无法访问服务,可能是安全组没有配置,到服务器一看,没有配置安全组,将项目中使用到的端口在服务器安全组中进行配置。

Teach you step by step how to deploy WeChat applet and go online

配置Nginx

将安全组配置之后,还需要配置Nginx进行转发,本次使用的端口不是80端口。找到Nginx配置文件所在位置:

/www/server/nginx/conf
Copy after login

通过命令vim nginx.conf查看配置文件的路径为:因此需要到这个路径下对服务进行配置。

include /www/server/panel/vhost/nginx/*.conf;
Copy after login

Teach you step by step how to deploy WeChat applet and go online

进入到配置文件所在的文件夹

cd /www/server/panel/vhost/nginx/
Copy after login

新建一个文件

mkdir wxtool.conf
Copy after login

  输入如下信息,listen后面是需要监听的端口信息,server_name是需要配置的域名信息。root后面跟着的是项目所在的路径信息。需要注意的是要加入代理信息。否则可能无法访问到项目路径。proxy_***之后的信息就是需要配置的代理信息了。ssl_certificate和ssl_certificate_key是申请的SSL文件的路径信息。

server
{
    listen 80;
    listen 443 ssl http2;
    server_name weixin.******.com;
    index index.php index.html index.htm default.php default.htm default.html;
    root /java/springboot;
    if ($server_port !~ 443){
        rewrite ^(/.*)$ https://$host$1 permanent;
    }
	
	location / {
    proxy_pass http://127.0.0.1:8080;
    proxy_set_header Host $host:80;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	}
    #HTTP_TO_HTTPS_END
    ssl_certificate    /etc/letsencrypt/live/weixin/6199589_weixin.ruankaoti.com.pem;
    ssl_certificate_key    /etc/letsencrypt/live/weixin/6199589_weixin.ruankaoti.com.key;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    error_page 497  https://$host$request_uri;

    #SSL-END
    
  
    error_page 404 /404.html;
    error_page 502 /502.html;
    #ERROR-PAGE-END
    
    
    #禁止访问的文件或目录
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }
 
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      30d;
        error_log off;
        access_log off;
    }
    
    location ~ .*\.(js|css)?$
    {
        expires      12h;
        error_log off;
        access_log off; 
    }
    access_log  /www/wwwlogs/weixin.*****.com.log;
    error_log  /www/wwwlogs/weixin.*****.com.error.log;
}
Copy after login

当配置文件和申请的SSL证书都配置完成之后,在宝塔页面Nginx管理台中点击重载配置即可。

Teach you step by step how to deploy WeChat applet and go online

测试项目

在浏览器中输入我们配置的域名信息https://weixin.****.com  可以看到已经可以正常访问网页了。

Teach you step by step how to deploy WeChat applet and go online

打开微信开发者工具,将域名信息配置到文件中,进行测试可以正常访问,截图如下:

Teach you step by step how to deploy WeChat applet and go online

  然后将前端的代码上传到测试版本,然后递交审核之后就可以正常发布了。整个审核流程预计一天左右。审核完成之后,需要管理人员登录到微信公众平台得后台进行上线,上线以后,大家就可以在小程序中访问项目了。给大家上一张已经发布上线的项目截图。

Teach you step by step how to deploy WeChat applet and go online

结语

  好了,以上就是记录一次部署微信小程序的过程并上线微信小程序,感谢您的阅读,希望您喜欢,如对您有帮助,欢迎点赞收藏。如有不足之处,欢迎评论指正。下次见。

【相关学习推荐:小程序开发教程

The above is the detailed content of Teach you step by step how to deploy WeChat applet and go online. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Xianyu WeChat mini program officially launched Xianyu WeChat mini program officially launched Feb 10, 2024 pm 10:39 PM

Xianyu's official WeChat mini program has quietly been launched. In the mini program, you can post private messages to communicate with buyers/sellers, view personal information and orders, search for items, etc. If you are curious about what the Xianyu WeChat mini program is called, take a look now. What is the name of the Xianyu WeChat applet? Answer: Xianyu, idle transactions, second-hand sales, valuations and recycling. 1. In the mini program, you can post idle messages, communicate with buyers/sellers via private messages, view personal information and orders, search for specified items, etc.; 2. On the mini program page, there are homepage, nearby, post idle, messages, and mine. 5 functions; 3. If you want to use it, you must activate WeChat payment before you can purchase it;

WeChat applet implements image upload function WeChat applet implements image upload function Nov 21, 2023 am 09:08 AM

WeChat applet implements picture upload function With the development of mobile Internet, WeChat applet has become an indispensable part of people's lives. WeChat mini programs not only provide a wealth of application scenarios, but also support developer-defined functions, including image upload functions. This article will introduce how to implement the image upload function in the WeChat applet and provide specific code examples. 1. Preparatory work Before starting to write code, we need to download and install the WeChat developer tools and register as a WeChat developer. At the same time, you also need to understand WeChat

What is the name of Xianyu WeChat applet? What is the name of Xianyu WeChat applet? Feb 27, 2024 pm 01:11 PM

The official WeChat mini program of Xianyu has been quietly launched. It provides users with a convenient platform that allows you to easily publish and trade idle items. In the mini program, you can communicate with buyers or sellers via private messages, view personal information and orders, and search for the items you want. So what exactly is Xianyu called in the WeChat mini program? This tutorial guide will introduce it to you in detail. Users who want to know, please follow this article and continue reading! What is the name of the Xianyu WeChat applet? Answer: Xianyu, idle transactions, second-hand sales, valuations and recycling. 1. In the mini program, you can post idle messages, communicate with buyers/sellers via private messages, view personal information and orders, search for specified items, etc.; 2. On the mini program page, there are homepage, nearby, post idle, messages, and mine. 5 functions; 3.

Implement the drop-down menu effect in WeChat applet Implement the drop-down menu effect in WeChat applet Nov 21, 2023 pm 03:03 PM

To implement the drop-down menu effect in WeChat Mini Programs, specific code examples are required. With the popularity of mobile Internet, WeChat Mini Programs have become an important part of Internet development, and more and more people have begun to pay attention to and use WeChat Mini Programs. The development of WeChat mini programs is simpler and faster than traditional APP development, but it also requires mastering certain development skills. In the development of WeChat mini programs, drop-down menus are a common UI component, achieving a better user experience. This article will introduce in detail how to implement the drop-down menu effect in the WeChat applet and provide practical

Use WeChat applet to achieve carousel switching effect Use WeChat applet to achieve carousel switching effect Nov 21, 2023 pm 05:59 PM

Use the WeChat applet to achieve the carousel switching effect. The WeChat applet is a lightweight application that is simple and efficient to develop and use. In WeChat mini programs, it is a common requirement to achieve carousel switching effects. This article will introduce how to use the WeChat applet to achieve the carousel switching effect, and give specific code examples. First, add a carousel component to the page file of the WeChat applet. For example, you can use the <swiper> tag to achieve the switching effect of the carousel. In this component, you can pass b

How to use PHP to develop the second-hand transaction function of WeChat applet? How to use PHP to develop the second-hand transaction function of WeChat applet? Oct 27, 2023 pm 05:15 PM

How to use PHP to develop the second-hand transaction function of WeChat applet? As a popular mobile application development platform, WeChat applet is used by more and more developers. In WeChat mini programs, second-hand transactions are a common functional requirement. This article will introduce how to use PHP to develop the second-hand transaction function of the WeChat applet and provide specific code examples. 1. Preparation work Before starting development, you need to ensure that the following conditions are met: the development environment of the WeChat applet has been set up, including registering the AppID of the applet and setting it in the background of the applet.

Implement image filter effects in WeChat mini programs Implement image filter effects in WeChat mini programs Nov 21, 2023 pm 06:22 PM

Implementing picture filter effects in WeChat mini programs With the popularity of social media applications, people are increasingly fond of applying filter effects to photos to enhance the artistic effect and attractiveness of the photos. Picture filter effects can also be implemented in WeChat mini programs, providing users with more interesting and creative photo editing functions. This article will introduce how to implement image filter effects in WeChat mini programs and provide specific code examples. First, we need to use the canvas component in the WeChat applet to load and edit images. The canvas component can be used on the page

Implement image rotation effect in WeChat applet Implement image rotation effect in WeChat applet Nov 21, 2023 am 08:26 AM

To implement the picture rotation effect in WeChat Mini Program, specific code examples are required. WeChat Mini Program is a lightweight application that provides users with rich functions and a good user experience. In mini programs, developers can use various components and APIs to achieve various effects. Among them, the picture rotation effect is a common animation effect that can add interest and visual effects to the mini program. To achieve image rotation effects in WeChat mini programs, you need to use the animation API provided by the mini program. The following is a specific code example that shows how to

See all articles