preface

Do you want to experience the happiness of the classic Q Version Western Journey? Want to experience the nobility of full VIP? Want to experience a quick and refreshing move? All kinds of best equipment, wings, pets for you, in the dream journey to the west!

This article explains the fantasy Westward Journey H5 game set up tutorial, want to study how to achieve the H5 game, experience the game in the second day second to second air must not miss.

I set up a dream journey to the West link: game.echeverra.cn, login will send full VIP and lifetime card, follow my wechat public account echeverra send “dream Journey to the West GM”, tell me your game role name, I will give you the first time to authorize the background GM, come to experience.

Before writing big angel sword H5 game ultra detailed graphics set up tutorial, the game link: http://39.105.134.68:81, interested can also look at.

Archangel sword is a classic legendary game, this time set up a dream journey to the West is a classic turn-based game.

Game screenshots:

The erection

1. Set up conditions

Dream westward Journey erection needs preparation:

  1. For Linux servers, centos7/8 is recommended. Aliyun and Tencent cloud are recommended.
  2. Game source code, pay attention to my public number Echeverra, send “dream westward Journey” to obtain.

The game source code has removed ads and fixed some features.

2. Install the pagoda and the environment

Pagoda is a server operation and maintenance management software, installation commands:

Yum install wget - y && wget - O the sh http://download.bt.cn/install/install_6.0.sh && sh the shCopy the code

After the installation, log in to the pagoda as prompted (if the access is not possible because port 8888 is not open on the server, refer to article 5 open Port), and search for the following software installation in the Pagoda software store:

  1. Web server: Nginx 1.20
  2. Database: mysql 5.6
  3. Programming languages: PHP 5.6, PHP 7.4
  4. Database management tool: phpMyAdmin 4.9

3. Upload the source code

Get the source code after decompression will get SQL and xyh5 two files, xyh5 compressed file uploaded to the root directory through the pagoda (if the pagoda prohibits uploading to the root directory, you can upload other paths after cutting and pasting to the root directory).

Decompress the file to the root directory

After decompressing the package, grant 777 permission by running commands

chmod -R 777 /home/server
chmod -R 777 /www/wwwroot/xy
Copy the code

Install the Lua script

Gz CD lua-5.1.5 make Linux test && make installCopy the code

Install LuA-related dependencies

yum install readline-dev readline-devel unzip
Copy the code

Install the module management tool Luarocks

CD /home/soft tar -zxvf luarocks-3.0.4.tar.gz CD luarocks-3.0.4/./configure --with-lua=/usr/local --with-lua-include=/usr/local/include make && make install && make bootstrap luarocks install luasocketCopy the code

4. Import the database

Change the database root password through the pagoda: echeverra (related to security issues, it is recommended to change to your own password, the corresponding source echeverra also need to be replaced with your own password, it is recommended to use Webstorm or VScode IDE global search and replace).

Open database remote permission:

mysql -u root -pecheverra
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'echeverra' WITH GRANT OPTION;
FLUSH   PRIVILEGES;
quit
Copy the code

Create the following database:

  1. account
  2. chargeserver
  3. Gameserver (Character set UTF-8, collation UTf8_unicode_ci)
  4. gmserver
  5. oaglobal
  6. operationanalysisserver
  7. worldserver

Upload the database file in the SQL folder and import the database file. For example, the account is the default user name and password. The root account is used in the code.

5. Open ports

Ports to be opened:

  1. Pagoda: 8888
  2. Phpmyadmin: 888
  3. Mysql: 3306
  4. Game related ports: 80, 10001, 11001, 12001, 8001, 8004

Open port of the server, take Aliyun open port 10001 as an example, other ports are added in the same way, and other servers are also set in security.

Port 10001 is also used as an example:

If you do not open the port, the service will not be accessible. If you have no security requirements, you can directly open the port from 1 to 65535.

6. Modify IP

Source IP is my own VIRTUAL machine IP, need to replace with your own server IP.

Files whose IP addresses need to be changed:

/www/wwwroot/xy/cdn/preload.js
/www/wwwroot/xy/cdn/index.min.html
/www/wwwroot/xy/cdn/serverlist.php
/www/wwwroot/xy/cdn/serverlist.json
Copy the code

For example, modify the preload.js file in the same way as other files.

Double-click preload.js to open edit mode, press Ctrl+F to search for 39.105.134.68, replace it with your server IP and save.

7. Create a game website

To access the game, add the website domain name to your IP address, root directory is/WWW /wwwroot/xy/, and select PHP version 5.6.

8. Start the game

With that done, it’s time to start the exciting game. Start the command:

cd /home/server
sh start.sh
Copy the code

After successful startup, check whether ports 10001, 11001, 12001, 8001, and 8004 are monitored. If any port is missing, the game cannot be started successfully.

netstat -lntp
Copy the code

Visit the game link: http://IP/cdn/, using your server’s IP.

Enter the user name and password, click one key to register or log in, wait for the completion of resource loading, select partition (only one zone), enter the game, Nice~

If the load reaches 95% and does not move for a period of time, port 10001 is not monitored.

9. The GM tool

The game GM tool access link: http://IP/gm/gm.php, account admin, password 123456, you can authorize the GM function to the game players, also can recharge the players to send items.

Check email after refreshing the game.

10. Turn off the game

Close game execution command:

cd /home/server
sh stop.sh
Copy the code

subsequent

1. Modify the GM account

User name password modified GM need to modify the file/WWW/below/xy/GM/config. PHP.

If you modify $admin and $gmcode, you can change the GM account and password. Note that the $key cannot be modified at will. If you change the $key, you need to adjust the gmkey value to pass the authentication.

2. Authorized source code analysis

The GM tool can grant GM authorization to game players. There are two kinds of authorization. Vip1 recharge can only be used for yuan recharge, and VIP2 recharge email can be used for yuan recharge and goods sending. So how does it work in code? We open the /gm/ adminQuery.php file.

$uid, $PWD, $qu, $PWD, $qu, $PWD, $qu, $PWD, $qu, $PWD, $qu, $PWD.

Open vip1.json to see the saved data:

Similarly, the authorized player will also read the vip1.json file to verify whether the user is a VIP user by opening the player’s GM login through http://IP/gm/. Therefore, the password of the player’s GM login and GM account are 123456, not the password of the player’s account.

3. Use domain names for access

If you are curious, you will find that the game link I set up is game.echeverra.cn, not IP. This is because the archangel sword I built before is in THE form of IP

Change domain name access is also very simple, need to modify the following:

Modify file:

/www/wwwroot/xy/cdn/preload.js
/www/wwwroot/xy/cdn/index.min.html
Copy the code

Note that the/CDN/after using the domain name path is also omitted.

Set the root directory to/WWW /wwwroot/xy/ CDN /.

Echeverra.cn: / WWW /wwwroot/xy/gm/, gm/ echeverra.cn: / WWW /wwwroot/xy/gm/

The above is all the pictures and texts of dream Journey to the West. I hope it will be helpful to you. If you have any questions, please contact me through my blog echeverra.cn or wechat official account echeverra.

Did you learn to “waste”?


The article first appeared in my blog echeverra.cn/xyh5, original article, reproduced please indicate the source.

Welcome to follow my wechat official account Echeverra to learn and make progress together! Uncertain when there are resources and welfare oh!