# \[Windows]\[Advanced] Canary + XAMPP + MyAAC

{% hint style="info" %}

* **If you not compiled Canary, start following this tutorial at step 1.**
* **If you already compiled Canary, start following this tutorial at step 2.**
  {% endhint %}

{% hint style="danger" %}

### It is not recommended to use XAMPP in production, it should be used only for tests. Use at your own risk.

{% endhint %}

## **1 - Download Canary:**

* [Download](https://github.com/opentibiabr/canary)
* Extract Canary server in a folder of your preference.

### **Compiled Canary:**

* [Download](https://docs.opentibiabr.com/opentibiabr/projects/canary/about#nightly-packages)

## **2 - Download XAMPP:**

* [Download](https://sourceforge.net/projects/xampp/files/XAMPP%20Windows/8.2.4/xampp-windows-x64-8.2.4-0-VS16-installer.exe/download)

## **3 - Installation:**

<details>

<summary>XAMPP</summary>

<img src="https://content.gitbook.com/content/zV9t92sKcMkphxwdvwZs/blobs/khZtUzGuu8JPEGs3NqaR/xampp1.png" alt="" data-size="original">

<img src="https://content.gitbook.com/content/zV9t92sKcMkphxwdvwZs/blobs/EZcQ7owpp6qSHnie61ff/xampp2.png" alt="" data-size="original">

<img src="https://content.gitbook.com/content/zV9t92sKcMkphxwdvwZs/blobs/eQXHMwvbIW9mJQvDCgZE/xampp3.png" alt="" data-size="original">

<img src="https://content.gitbook.com/content/zV9t92sKcMkphxwdvwZs/blobs/wf61fBlg07AwVC5488PZ/xampp4.png" alt="" data-size="original">

<img src="https://content.gitbook.com/content/zV9t92sKcMkphxwdvwZs/blobs/KNPJhDyNAA8cqpUaGVS7/xampp5.png" alt="" data-size="original">

<img src="https://content.gitbook.com/content/zV9t92sKcMkphxwdvwZs/blobs/EZSkTwZeYKBUJkALWAHV/xampp6.png" alt="" data-size="original">

</details>

## **4 - Configuration:**

<details>

<summary>Configuration XAMPP</summary>

### **4.1.1 - Enable PHP Extensions:**

* Open XAMPP.
* Apache Actions -> Config -> PHP (php.ini).
* Enable the PHP extensions uncommenting the lines with ;
* `extension=gd`
* `extension=zip`
* Change:
* `post_max_size=100M`
* `upload_max_filesize=100M`
* Save the file.

### **4.1.2 - Start XAMPP:**

* On **Apache,** click in the **Start** butto&#x6E;**;**
* On **MySQL,** click in the **Start** button.
* ![](https://1381914140-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzV9t92sKcMkphxwdvwZs%2Fuploads%2FX12YqpKNWQ46vB3EUzea%2Fxampp1.png?alt=media\&token=5e893692-565b-4d04-ae40-77701c1be7c6)
* It should be like thi&#x73;**:**
* ![](https://1381914140-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzV9t92sKcMkphxwdvwZs%2Fuploads%2FaFow9BRwJ00u7MFqUE8J%2Fxampp2.png?alt=media\&token=f9965542-f30e-4244-b8a7-0228e823823f)

### **4.1.3 - MySQL password change:**

* Check if apache and mysql services are running, then click the Shell button.
* In the shell that opened - command line - enter the following command:

mysqladmin.exe -u root password your-new-password

* Password changed.&#x20;

### **4.1.4 - PhpMyAdmin password change:**

* Open the folder where XAMPP was installed (C:\xampp);
* Access the phpMyAdmin folder;
* Open the config.inc.php file in a text editor of your choice and change the fields below:
* You can use this generator to change the secret word (blowfish\_secret): [https://phpsolved.com/phpmyadmin-blowfish-secret-generator/?g=\[insert\_php\]echo $code;\[ /insert\_php](https://phpsolved.com/phpmyadmin-blowfish-secret-generator/?g=%5Binsert_php%5Decho%20%24code;%5B/insert_php)

```
$cfg['blowfish_secret'] = 'xampp'; /* YOU SHOULD CHANGE THIS FOR A MORE SECURE COOKIE AUTH! */
```

* Change the authentication mode to:

```
$cfg['Servers'][$i]['auth_type'] = 'http';
```

* Change the password, remember to use the password you changed in the Shell:

```
$cfg['Servers'][$i]['password'] = 'your-new-password';
```

* Change the **AllowNoPassword option** to:

```
$cfg['Servers'][$i]['AllowNoPassword'] = false;
```

&#x20;All right, let's go. Your MySQL and PHPMyAdmin are configured for the new password. Now you only always use it when installing an application that connects to a MySQL Database.\
&#x20;

### **4.1.5 - Change of port 80 in XAMPP:**

* By default, some software, other local server, Windows firewall use port 80. Below are the steps on how to change port 80 in XAMPP:
* Open the XAMPP panel and click the Apache **Config** **button;**
* Choose the file called **httpd.conf**. It has all apache operating parameters;
* Press the **Ctrl + F keys** and search for the word **Listen 80;**
* Add one more number 80 (or 90) to the end of this parameter by getting: **Listen 8080;** (or **Listen 8090;**)
* Search for another keyword called **ServerName and** add the 80 (or 90) in **localhost:8080;** (or **localhost:8090;**)
* Save and close the file;
* Go back to the Dashboard and click the **Config icon;**
* Then go to **Service and Port Settings;**
* Add the **8080 (or** **8090)**&#x69;n the **Main Port;**
* After these steps try to start your Apache, check if you have the green icon, open **your browser, type <http://127.0.0.1:8080>** \*\*(or [http://127.0.0.1:8090)\*\*\&#x61;nd](https://docs.opentibiabr.com/opentibiabr/projects/canary/getting-started/installing/windows/xampp/http:/127.0.0.1:8090\)**\&#x61;nd) analyze if you can access the Dashboard of your XAMPP.&#x20;

### **4.1.6 - Domain configuration in vhosts:**

* In addition to people being able to access your site by your domain, you need to configure the vhost file in XAMPP:
* Open the **httpd-vhosts.conf file (C:\xampp\apache\conf\extra).**
* Edit the following lines:

```
##<VirtualHost *:80>
    ##ServerAdmin webmaster@dummy-host2.example.com
    ##DocumentRoot "C:/xampp/htdocs/dummy-host2.example.com"
    ##ServerName dummy-host2.example.com
    ##ErrorLog "logs/dummy-host2.example.com-error.log"
    ##CustomLog "logs/dummy-host2.example.com-access.log" common
##</VirtualHost>
```

* Switch to your domain.
* Examples:[ ](https://forums.otserv.com.br/index.php?/forums/topic/169239-avan%C3%A7adowindowsmysqlotservbr-global-xampp-myaac/)&#x20;
* Example 1:

```
<VirtualHost seusite.com:80>
    ServerAdmin seuemail@xd.com
    DocumentRoot "C:/xampp/htdocs"
    ServerName seusite.com
    ErrorLog "logs/seusite.com-error.log"
    CustomLog "logs/seusite.com-access.log" common
</VirtualHost> 
```

* Example 2:

```
<VirtualHost seusite.com:8080>
    ServerAdmin seuemail@xd.com
    DocumentRoot "C:/xampp/htdocs"
    ServerName seusite.com
    ErrorLog "logs/seusite.com-error.log"
    CustomLog "logs/seusite.com-access.log" common
</VirtualHost> 
```

* Example 3:

```
<VirtualHost seusite.com:8090>
    ServerAdmin seuemail@xd.com
    DocumentRoot "C:/xampp/htdocs"
    ServerName seusite.com
    ErrorLog "logs/seusite.com-error.log"
    CustomLog "logs/seusite.com-access.log" common
</VirtualHost>
```

### **4.2 - Domain configuration or external ip in the Windows hosts file:**

* You have to put your external ip in config.lua for others to connect, but sometimes that makes you unable to connect to your own server.
* Specify your domain (or external ip) in config.lua, it will look like this:
* ip = "example.com"
* Open the **C:\Windows\System32\drivers\etc\hosts file** and add:

192.168.0.1 example.com

(IPv4) (domain)

### **4.3 - Ports:**

* Make sure ports 80 (or 8080, 8090), 7171, 7172 are open for the connection to work properly.
* To release the ports, search for the model of your modem/router. Below a site with guides for various routers to assist in the rel

</details>

## **5 - Database:**

* Access PHPMyAdmin from your domain address.
* On the left side click on +New and create a database (e.g. canary).
* Import the schema file.sql which is in the Canary server folder.

## **6** - Config.lua:

<details>

<summary>For data-canary</summary>

```lua
-- Core settings
-- Note: If you want to use datapack folder canary (custom), put only "data-canary"
-- If you want to use the global datapack folder, put "data-otservbr-global"
-- If "useAnyDatapackFolder" is set to true then you can choose any datapack folder for your server
useAnyDatapackFolder = false
dataPackDirectory = "data-canary"
-- Don't change this unless you know what you're doing
coreDirectory = "data"

-- Map
-- NOTE: set mapName WITHOUT .otbm at the end
-- NOTE: If toggleDownloadMap if false, then the mapDownloadUrl will not be used
-- NOTE: If a map with the name already exists in the world folder, the map will not be downloaded even if the toggleDownloadMap is true
toggleDownloadMap = false
mapName = "canary"

-- Custom Map
-- NOTE: toggleMapCustom set to true will load all maps in custom map folder
toggleMapCustom = false

-- Connection Config
ip = "example.com"
serverName = "Canary"

-- MySQL
mysqlHost = "127.0.0.1"
mysqlUser = "root"                      
mysqlPass = "your-new-password"                       
mysqlDatabase = "canary"        
mysqlPort = 3306
mysqlSock = ""
passwordType = "sha1"
```

</details>

<details>

<summary>For data-otservbr-global</summary>

```lua
-- Core settings
-- Note: If you want to use datapack folder canary (custom), put only "data-canary"
-- If you want to use the global datapack folder, put "data-otservbr-global"
-- If "useAnyDatapackFolder" is set to true then you can choose any datapack folder for your server
useAnyDatapackFolder = false
dataPackDirectory = "data-otservbr-global"
-- Don't change this unless you know what you're doing
coreDirectory = "data"

-- Map
-- NOTE: set mapName WITHOUT .otbm at the end
-- NOTE: If toggleDownloadMap if false, then the mapDownloadUrl will not be used
-- NOTE: If a map with the name already exists in the world folder, the map will not be downloaded even if the toggleDownloadMap is true
toggleDownloadMap = true
mapName = "otservbr"

-- Custom Map
-- NOTE: toggleMapCustom set to true will load all maps in custom map folder
toggleMapCustom = true

-- Connection Config
ip = "example.com"
serverName = "OTServBR-Global"

-- MySQL
mysqlHost = "127.0.0.1"
mysqlUser = "root"                      
mysqlPass = "your-new-password"                       
mysqlDatabase = "otservbr-global"        
mysqlPort = 3306
mysqlSock = ""
passwordType = "sha1"
```

</details>

## 7 - MyAAC:

### 7.1 - Download:

* Download the **myaac-1.x.zip** file.
* [Download](https://github.com/slawkens/myaac/releases/latest)

### 7.2 - Installation:

<details>

<summary>MyAAC</summary>

* Go to **C:\xampp\htdocs** and delete all files inside.
* Unzip downloaded MyAAC files and paste the content into **C:\xampp\htdocs.**
* At the end it looks like this:
* ![](https://1381914140-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzV9t92sKcMkphxwdvwZs%2Fuploads%2FxK6QRqmUTgD8GFHU1Byu%2Fmyaac_folder_xampp.png?alt=media\&token=cace8088-43ce-428b-bd7d-dc58ab040a63)
* If you are installing on localhost, access <http://127.0.0.1> to load MyAAC.
* If you are installing with ip or domain, access <http://your-ip-or-domain> to load MyAAC.&#x20;
* Follow the installation steps to install MyAAC.

</details>

## **8 - Starting and Connecting to the Server:**

### **8.1 - Starting the Server:**

* Double click canary.exe, it will start the server.

### 8.2 - Connecting to the Server:

* To connect to the server according to the indicated version, you can use:
* [**Normal Client**](https://docs.opentibiabr.com/opentibiabr/downloads/clients/client-13)
* [**OTClient Redemption**](https://docs.opentibiabr.com/opentibiabr/projects/otclient-redemption/about#how-to-connect-on-canary-with-otclient-redemption)

If you changed the port to **8080** or **8090**, remember to add it in the **normal client** or **otclient redemption**.

## **9 - Credits:**

* **OpenTibiaBR (**[**https://github.com/opentibiabr/canary**](https://github.com/opentibiabr/canary)**)**
* **Slawkens  (**[**https://github.com/slawkens/myaac**](https://github.com/slawkens/myaac)**)**
* **Tutorial:**
* **Majesty**
