当前位置:网站首页>Do not rent servers, build your own personal business website (3)
Do not rent servers, build your own personal business website (3)
2022-07-24 06:17:00 【CpolarLisa】
In the previous Introduction , We have successfully established a decent 、 And it can be extended to change the appearance style of dynamic web pages , But I want to make this website a carrier of business behavior , It also needs to be accessible to public Internet users . So we need to be right about WordPress Make some changes to the configuration file of the web page , And in cpolar With the help of the , Open the data tunnel between local electronic devices and the public Internet . It should be noted that , Due to WordPress Changing the configuration file requires rewriting the configuration code , A little carelessness will result in our web page being inaccessible , Therefore, care must be taken . Now? , Let's see , How to change WordPress Configuration of , And set up cpolar Data tunnel .
It is the same as the general concept of tunnel , The data tunnel must have at least two ports to connect different areas , So we have to go back to the local computer , Get through cpolar And WordPress Channel between website output ports . But first of all, , Need make WordPress Configuration changes , Give Way WordPress Learn how to correctly handle web access requests from other than local electronic devices .
Here we will use code editing software for the time being Visual Studio Code( Download at “https://code.visualstudio.com/Download”, After downloading and installing , The software will ask whether to change the language to Chinese when it is first used , We can choose to change ). Open on your local computer VS Code, In the upper left corner “ file ” Options “ Open file ”,

In the file selection box that pops up , find PHPstudy Under the installation folder of WWW Folder , Enter this folder to select and place WordPress Folder ( In this example, it is the file path of our local website , The specific path needs to be based on PHPstudy The actual installation position ), selection web3 In folder “wp-config.php” file .

Find “wp-config.php” After the document , Click on the “ open ” Button , You can enter the configuration file modification interface , It seems to have the feeling of the code interface that programmers face every day . next , We find the location of the code that needs to be modified , Paste the following two command lines ( Because the command line has complete punctuation / Strict requirements for half angle , Therefore, we recommend copying the following code directly , Avoid input format errors )
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']);
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);And modify the location of the code , As shown in the figure below

This is an important step ! If there is no right WordPress Make the right configuration , When facing the access request of public network visitors ,WordPress Will not be able to cope correctly , Cause visitors to fail to visit the local website ! All the work we have done before will also be meaningless ! After entering the code , Then click... At the top of the code page “X” Save it and close it , Quit again VS code Program .

At this time, we teach WordPress, How to correctly deal with web page access requests outside the local . next , We go back to windows The start menu of , Find from cpolar client .

Click start cpolar, After entering the login name and password , Get into cpolar Client main interface . Find... On the left “ Tunnel management ” Under “ Create a tunnel ” Button , Click to enter the data tunnel creation page , Enter information about our local web page , Integrate the public Internet with WordPress Connect the web output port .

The settings here need attention ,“ Local address ” It's that we use PHPstudy When creating a web page , Enter the port number . If this item is filled in incorrectly , It will cause an error in the access port of Internet visitors , As a result, the local website cannot be accessed . After filling in the relevant information , You can click... Below “ establish ” Button , Establish a data tunnel between the public Internet and local web pages . To verify whether the data tunnel is established , We can click cpolar On the left side of the client main interface “ state ” bar , Select from the drop-down menu “ Online tunnel list ”, See the data tunnel we just established .

ad locum , We can see more clearly ,“ Public address ” It is the entrance of the data tunnel , and “ Local address ” Is the exit of the data tunnel , Visitors to the public Internet can use the public address ( Tunnel entrance ), Visit the website at your local address ( Tunnel exit ), vice versa . That is, the web page on the local electronic device , Successfully published on the public Internet . We can copy the public address , And enter... In the browser address bar , Verify the effectiveness of the tunnel .

Here we can see ,cpolar Establish a data tunnel , Effectively connect the public Internet and local websites , So that public visitors can directly access the business website on the local computer . Thus, the cost of renting public network servers is avoided , And it allows us to easily maintain our own business website on the local computer .
Although our local website can be accessed by public website visitors , But at this time, the URL of our website is still very complex , And it can't reflect the connection with our business activities ( Whether it's the company name or the product name 、 Even short video blogger name ), So we still need to polish this website . Due to the large content and limited space , We will introduce it later , Explain in detail , How to put the website address of the commercial website , Change to the website we want . If you are right about cpolar Have any questions , Welcome to contact us , We will certainly provide you with assistance within our ability . Of course, welcome to join cpolar Of VIP Official group , Explore together cpolar The infinite potential of .
边栏推荐
- Flink function (1): rich function
- IP notes (9)
- Unity2d game let characters move - next
- Hololens 2 development: use MRTK and simulate gesture input in unity
- What is monotonic queue
- IP notes (8)
- Read the qualified line of CSV file and write it to another CSV
- Headlong platform operation
- IP笔记(12)
- leetcode剑指offer JZ42 连续子数组的最大和
猜你喜欢
随机推荐
unity2D游戏之让人物动起来-下
IP笔记(10)
Openpose2d transform 3D pose recognition
Dameng database_ Supported table types, usage, characteristics
IP笔记(6)
【217】#!/usr/bin/env 的意义
Dameng database_ User password policy
Understanding of Flink parallelism
ip作业(1)
Read the qualified line of CSV file and write it to another CSV
不租服务器,自建个人商业网站(2)
什么是单调队列
常见十大漏洞总结(原理、危害、防御)
公网访问内网IIS网站服务器【无需公网IP】
leetcode剑指offer JZ3 数组中重复的数字
IP笔记(11)
【无需公网IP】为远程桌面树莓派配置固定的公网TCP端口地址
MySQL数据库—SQL汇总(记得关注我!中国加油!)
HoloLens 2 开发101:创建首个HoloLens 2应用程序
Dameng database_ Common initialization parameters








