Deploy SSCMS content management system on Linux system and achieve external network access

1. Introduction to SSCMS

Based on .NET Core, SSCMS can build a fully functional, high-performance, large-scale and easy-to-maintain website platform in the shortest possible time with the lowest cost and minimum manpower investment.

2. Introduction to cpolar

2.1 Introduction to cpolar

cpolar: Expose a local Web site to the public network. With just one line of command, you can publish the intranet site to the public network for easy demonstration to customers. Efficiently debug WeChat official accounts, mini programs, dock with Alipay gateway and other cloud services to improve your programming efficiency.

2.2 cpolar usage scenarios

Common usage scenarios of cpolar:

  • Expose a local web site
  • WeChat public account development and debugging
  • Test on mobile devices
  • Remote control Raspberry Pi

3. Introduction to local environment

3.1 Local environment planning

This practice is a personal test environment, and the operating system version is centos7.6.

hostname IP address Operating system version Docker version Intranet penetration tool
jeven 192.168.3.166 centos 7.6 20.10.17 cpolar

3.2 Introduction to this practice

1. The deployment environment for this practice is a personal test environment, please use it with caution in the production environment;
2. Deploy the SSCMS content management system in a Docker environment;
3. Access the SSCMS service deployed in the intranet from the external network through cpolar.

4. Local environment inspection

3.1 Check Docker service status

Check whether the Docker service is running normally and ensure that Docker is running normally.

[root@jeven ~]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2023-08-23 23:41:16 CST; 2 days ago
     Docs: https://docs.docker.com
 Main PID: 9562 (dockerd)
    Tasks: 75
   Memory: 550.6M

3.2 Check Docker version

Check Docker version

[root@jeven ~]# docker -v
Docker version 20.10.17, build 100c701

3.3 Check docker compose version

Check the Docker compose version to make sure it is above 2.0.

[[root@jeven ~]# docker compose version
Docker Compose version v2.19.1

5. Deploy SSCMS service

4.1 Create SSCMS container

Use docker-cli command to quickly create SSCMS container

docker run -d \
    --name my-sscms \
    -p 8011:80 \
    --restart=always \
    -v volume-sscms:/app/wwwroot \
    -e SSCMS_SECURITY_KEY=e2a3d303-ac9b-41ff-9154-930710af0845 \
    -e SSCMS_DATABASE_TYPE=SQLite \
    sscms/core

Insert image description here

5.2 Check SSCMS container status

Check the SSCMS container status to ensure that the SSCMS container starts normally.

[root@jeven ~]# docker ps
CONTAINER ID   IMAGE                  COMMAND                  CREATED         STATUS                    PORTS                                            NAMES
f4ee09c6548a   sscms/core             "dotnet SSCMS.Web.dll"   5 minutes ago   Up 5 minutes              443/tcp, 0.0.0.0:8011->80/tcp, :::8011->80/tcp   my-sscms

5.3 Initial configuration of SSCMS

Access address: http://192.168.3.166:8011/, replace the IP with the IP address of your own server, and enter the SSCMS background management page.

Insert image description here

After clicking to enter the background management, initialize the settings for sscm.
Mainly set the administrator account and password, and the rest can be configured as default.

Insert image description here
Insert image description here
Insert image description here

After logging in to the backend management, choose to use the online site template to create a site.

Insert image description here

Choose an online template to create your site

Insert image description here

Set site information:
site name: myweb;
site type: website;
site level: main site;
the rest are default, click "Create Site".

Insert image description here
Insert image description here

5.4 Access SSCMS website services

Access address: http://192.168.3.166:8011/, enter the homepage of the SSCMS front-end website service.

Insert image description here

6. Initial configuration of cpolar

6.1 Log in to cpolar official website

cpolar official website address: https://www.cpolar.com/, register an account and log in to cpolar official website.

Insert image description here

6.2 Install cpolar tool

On the local SSCMS server, since the local server is centos7.6, execute the following command and use the script to install cpolar with one click.

curl -L https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bash

Insert image description here

6.3 Start cpolar service

Execute the following command to start the cpolar service.

systemctl enable cpolar && systemctl start cpolar

6.4 Check cpolar version

Check cpolar version

[root@jeven ~]# cpolar version
cpolar version 3.3.12

6.5 token authentication

After logging in to the cpolar official website, click Verify on the left to view your authentication token.

Insert image description here

Copy the token and execute the following command on the copied token:

cpolar authtoken tokenxxx

Insert image description here

6.5 Restart the cpolar service

Use the following command to restart the cpolar service.

systemctl restart cpolar

Check cpolar service status

[root@jeven ~]# systemctl status cpolar.service
● cpolar.service - Cpolar Service
   Loaded: loaded (/etc/systemd/system/cpolar.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2023-10-18 03:23:30 CST; 14h ago
     Docs: https://www.cpolar.com/docs
 Main PID: 9320 (cpolar)
    Tasks: 16
   Memory: 49.3M
   CGroup: /system.slice/cpolar.service
           ├─ 9320 cpolar: master process
           └─12616 cpolar: worker process

Oct 18 03:23:30 jeven systemd[1]: Started Cpolar Service.

7. External network configuration of SSCMS service

7.1 View the help information of cpolar command

Use the help option to query the help information of the cpolar command.

 cpolar help

Insert image description here

7.2 View online tunnels

Log in to the cpolar official website and click on the status on the left. The online tunnel list displays the 2 tunnels created by default:
1. website tunnel, pointing to port 8080,
2. http protocol (the http protocol will generate 2 public network addresses by default, one is http, Another https, eliminating the tedious steps of configuring an SSL certificate).

Insert image description here

7.3 Access cpolar web ui management interface

When we successfully install cpolar on Linux, we can use cpolar's intranet penetration function to implement applications in a variety of scenarios.
You can use the following method to access http://192.168.XX.XX:9200. The default port is 9200. Open a browser to access the local port 9200 and log in using the cpolar account and password. After logging in, you can manage the tunnel.

Insert image description here

Insert image description here

7.4 View the default tunnel list

After cpolar is successfully installed, 2 sample tunnels will be installed by default, which can be edited or deleted:
1. ssh tunnel: pointing to local port 22, TCP protocol;
2. website tunnel: pointing to local port 8080, HTTP protocol.

Insert image description here

7.5 Expose local web site

Create an http tunnel pointing to the local port 8011.

cpolar http 8011

Generate the corresponding public network addresses, one for the http protocol and one for the https protocol (avoiding the tedious steps of configuring the SSL certificate), and copy them.

Insert image description here

Access the test at the browser address: http://61f71e5c.r10.cpolar.top, and you will access the local SSCMS web service.

Insert image description here

7.6 Configure background services

Since the public network address exposed by the above command will be closed and inaccessible after the window is closed, we need to save the parameters in the configuration file. It is convenient for the tunnel to automatically start running in the background every time it is turned on.

  • Edit the cpolar.yml file
 vim /usr/local/etc/cpolar/cpolar.yml
  • The new content of the cpolar.yml file is as follows:
authtoken: xxxxxxxxxxxx #认证token

tunnels:
  websscms:
    proto: http
    addr: "8011"
    region: cn_vip

Insert image description here

webstation: tunnel name, you can customize
proto: protocol, such as tcp or http
region: line area: cn cn_vip cn_top, etc., you can choose freely. For details, please refer to the official website document - Global Infrastructure

7.7 Start all tunnel tests

Execute the following command to start all tunnel tests.

cpolar start-all

Insert image description here

Reopen the cpolar address above in the browser.

Insert image description here

Use the cpolar access address of https to access the local SSCMS website service.

Insert image description here

8. Create a tunnel in cpolar web ui

8.1 Create tunnel

In cpolar web ui, create a new online tunnel:
Tunnel name: Customizable, be careful not to repeat
Protocol: http
Domain name type: Select a random domain name
Region: Select China Top

Insert image description here
Insert image description here

8.2 Copy public network address

In the online tunnel list, copy the public network access address.

Insert image description here

8.3 Access SSCMS website services

In the browser, enter the cpolar public network address and you can successfully access the SSCMS website service.

Insert image description here

Guess you like

Origin blog.csdn.net/jks212454/article/details/133910913
Recommended