Using Google Cloud to Build Flarum Light Forum

Time:2019-3-30

Preface

This tutorial is written for newcomers without any programming language foundation. It teaches you how to build a light forum.
You can visit https://flarum.org.cn/ for more information.

According to the operation method of this tutorial, you can successfully complete the building and put Flarum Forum online.
Before you start, you need to meet the following requirements: (Account registration needs to be done by yourself)

  1. Access to Google Web Sites Normally
  2. A Credit Card (Used to Register Google Cloud Service Account and G-suite Account)
  3. An Overseas Address (Used for Registering Domain Names)

Please note that installation and construction costs include:

  1. Two Hours Installation & Configuration Time
  2. Google Domain Name costs $12 a year & G-Suite membership costs $5 a month

You can save money by using domain name operators’domain names and STMP mailbox delivery services. How to save money is beyond the scope of this tutorial. Please complete this configuration with other related tutorials. Please note that the domain name and mailbox need to be provided by the same service provider.


Course

The Flarum build process involves the following environments:

  1. A Linux server running version 7 of CentOS (this tutorial takes Google Cloud Server as an example)
  2. Pagoda panel, one-click build LAMP environment (Linux, Apache, MySQL, PHP)
  3. Flraum 0.1.0 – Beta 8 (released on December 3, 2018)

The first partLAMP Environment Construction

1. Visit cloud. google. com in the browser and log in to your account. ClickConsoleCompute EngineCreate a VM instance

Name: Any name
Regions: Hong Kong and Taiwan are recommended
Area: ABC election
CPU: 1 vCPU or miniature CPU (CPU needs calculation in the process of building LAMP. It is recommended to choose vCPU, and then downgrade to miniature CPU after the completion of building.
Start disk: CentOS 7
Access permission scope: Allow default access permissions
Firewall: Allow HTTP Traffic & Allow HTTPS Traffic


2. Click on the menu key – VPC Network – external IP address to set the external IP address of the VM instance created just now to static (default is temporary), you need to set a name, please fill in any.


3. Click on the firewall rule to create a new firewall rule.

Name: Any name
Goal: All instances in the network
Source filtering conditions: select IP address range; fill in 0.0.0/0
Protocol and Port: [TCP: 8888] [TCP: 3036]


4. Go toVM exampleclickConnect SSHConnect to a remote Linux host.

To prevent SSH from dropping off during installation, two commands need to be added to the SSH configuration file to copy the following commands to SSH and press Enter (please use the shortcut key to copy and paste)

sudo vim /etc/ssh/ssh_config

This command means to open the ssh_config file for permission. After opening the file, use the keyboard direction key to find a suitable location. Press I key to enter the editing mode. Add the following two commands to the content of the configuration file. Press ESC key to exit the editing mode. Press: key, enter WQ to return and save the exit. (: WQ will be displayed at the bottom)

ClinetAliveInterval 30
ClineAliveCountMax 6

This generation of commands means that the server sends heartbeat to the client every 30 seconds.


5. Install pagoda panel in SSH (www.bt.cn).
Get ROOT privileges first, enter the following commands in SSH and return.

sudo su

Then enter the following installation command for pagoda panel and return. (Official Web Order)

yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh

Subsequently, SSH will prompt whether to install pagoda panels, in the SSH hit y return, start installation.
After installation, the pagoda panel security access link and account password will be generated. Please visit the link in the browser of the local computer.


6. Build the LAMP environment in the pagoda panel. Please select the following configuration and install it in a fast way. (The installation will last 1.5 hours after the start of the installation, no duty required)

Apache 2.4.25
MySQL 5.7.19
Pure-Ftpd 1.0.47
PHP 7.2
PhpMyAdmin 4.4


7. Choose from Pagoda PanelSoftware managementPHP7.2Installation extensionInstall the following extensions.

Fileinfo extension
Opcache extension
EXIF extension

Then inDisabled FunctionsDelete the option below.

proc_open


8. Choose from the Pagoda PanelwebsiteThenAdd site

Domain Name: Fill in your domain name such as baidu.com
Note: Arbitrary
Root directory: / www/wwroot/abc
FPT: Create | username: ABC
Database: Create MySQL | User Name: ABC
PHP:PHP-72
Classification: Default


The second partFlarum installation

1. Install Composer. Enter the following commands in SSH: Please run them line by line (4 groups of commands)

wget https://dl.laravel-china.org/composer.phar -O /usr/local/bin/composer
chmod a+x /usr/local/bin/composer
export PATH=$PATH:/root/.config/composer/vendor/bin
source /etc/profile

This command comes from the tutorial at https://www.godcheese.com/ind… There are minor defects, but they do not affect the use.


2. Install php-zip. Enter the following commands in SSH

yum install php-zip

3. Install Flarum and run the following commands line by line in SSH (4 groups)

cd /www/wwwroot/
mkdir flarum
cd flarum
composer create-project flarum/flarum . --stability=beta

This command means: move to the wwwroot folder, create the flarum folder, move to the flarum folder, and install flarum using Composer.


4. Click on the pagoda panelwebsiteWebsite nameWebsite directory

Change directory address to / www/wwroot/flarum/and click Save.
Change the running directory to / public and click Save.


5. Authorize folders. Set and run the following commands in SSH. Please run them line by line. (2 lines in total)

chmod -R 0777 /www/wwwroot/flarum/storage
chmod -R 0777 /www/wwwroot/flarum/public/assets

6. Enter the DNS of the Google Domain Name Management page and add the IP address of your VM instance to the custom resource record.

For example: @ A 1H XX.XXX.XXX.XX


The third partConfigure Flarum

1. Initialize Flarum and enter your domain name address in the browser. Then you can see that the forum is running and needs to be configured.

The database address is: localhost
You can easily get other parameters, just fill them in.


2. Disable caching. Flarum Beta 8 has a small cache Bug. The refreshed page in the forum does not refresh the content, but returns to a certain time period before it. The reason is the caching problem. Therefore, we just need to disable caching.
Click on the file in the pagoda panel and find the folder, / wwww/wwroot/flarum/public, which contains the. hataccess file (there’s another one outside, don’t make a mistake). Click Edit to start adding the following code in line 21 or line 22 of the file.

<IfModule mod_headers.c>
    Header set Cache-Control "no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires 0
</IfModule>

3. Set up SSL for the website. In the pagoda panel, after selecting the website-your domain name-pop-up settings window, apply for a pagoda SSL in the SL panel location, and then you need to ensure the normal operation of the website during this period.
When your SSL certificate is applied for, click Deployment, then open Mandatory HTTPS, then select the File Panel in the Pagoda Panel, go into the / www/wwroot/flarum directory, and have a config.php file to edit it.
Line 16 has your domain name http://xxx.com, please change http://to https:///, and then visit your website again, the SSL security lock will come out.


4. Set up SMTP mail delivery service to let your forum send validation mail to new users.
Visit G-suite, create a new account (independent from the normal GOOGLE account, not connected to each other), and then bind your domain name. During the binding process, you need to add CNAME records and MX records for the domain name DNS. (Two websites please login at the same time to set parameters easily)

@ MX 1H 10 aspmx.l.google.com. This is a Google Mail Server. You must add it to the domain name customization resource.

During the G-suite creation process, you will be guided to add CNAME records, probably

xxxxxxxxx CNAME 1h xxxxxxxxx.com

Then, you will pass it very soon. If you succeed, you will create an administrator account, such as username @your domain name.com. Please mark the account and password, which need to be set in the Flarum background.
In short, this registration part, you slowly explore it, I was also a variety of search, various attempts, can not be found. (Remember to read other people’s tutorials)

When all this is done, please visit your forum and go to the background page. Select the EMALL panel and set the parameters as follows:

Driver:SMTP
HOST:smtp.gmail.com
Port:465
Encryption:SSL
Username: [email protected] domain name.com (G-suite account)
Password: Your G-suite password
Sender: User name @your domain name.com (G-suite account)


So far, the basic success has been achieved! ____________ Beta 8 up to now: December 8 has not updated the Chinese language package, just use the English version for the time being, and see other tutorials in the future to make it complete Chinese culture.
There are some bugs: when the user retrieves the password, he will send a link to reset the password for the user. After clicking, he will reset the password. At this time, if he enters a 6-bit or irregular password without prompt feedback, the user will mistakenly think that the modification is successful.
Re-click the link to set a new password, must be more than 8 bits, after successful modification, the link will be invalid.
Search function can not achieve content search, because I am also a novice, December 3 began to understand what is LAMP, what is SSH, what is Linux and so on, I hope you have a good time.

I’m thinking about one question:
1. How to Make Baidu Income My Forum

That’s it. Beta 8 has a lot of minor problems that need to be improved slowly. I hope you will try.