How to configure the server locally on Nginx/Windows
02.08.2020
by desbarmitar (PT) #5488
Important before you start
- For the tutorial I will use the C:\CPPS folder as the root.
- If any of these programs are already installed there may be conflicts. I recommend uninstalling it. I am not responsible for conflict errors that appear.
I Part - Downloads
Download and Install WinNMP
https://sourceforge.net/projects/wtnmp/files/
(20.05 )
Install WinNMP
- Accept the agreement → Next
- Folder
C:\CPPS\WinNMP
→ Next - Components required: Redis, Last version PHP, Composer.phar and AcmePhp.phar → Next
- Check the box
Add \bin directory to your environmental Path
→ Next → Install - Uncheck the box
Launch WinNMP
→ Finish
Download and Install Python
https://www.python.org/downloads/
(3.8.4)
Install Python
- Customize installation → Next ->Next
- Check the box
Install for all users
- Check the box
Add Python to environment variables
- Folder
C:\CPPS\Python38
→ Install → Close
Download and Install PostgreSQL
https://www.enterprisedb.com/downloads/postgres-postgresql-downloads
(12.3)
Install PostgreSQL
- → Next → Folder
C:\CPPS\PostgreSQL\12
→ Next - Check all components boxes → Next
- Folder
C:\CPPS\PostgreSQL\12\data
→ Next - Password:
password
→ Next … Installing - Uncheck the box
Stack Builder
→ Finish
Download and Install Build Tools for Visual Studio 2019
https://visualstudio.microsoft.com/visual-cpp-build-tools/
Install Build Tools
- → Continue
- Select
Workloads
Tab - Check the box
C++ buid tools
→ Install - Close
II Part - Configurations
Legacy Play Files
- Extract from
legacy-media-(...).zip
the folderplay
toC:\CPPS
- Rename the folder to old and move to the folder
C:\CPPS\WinNMP\WWW
- Open
WinNMP
program - In the tab
Projects
selectRefresh Projects
- In the tab
Projects
selectProject Setup - Old
(tools icon). Will open the project setup window - Check the box
Enable Local Virtual Server
and click onEdit Nginx Virtual Server
Find
listen 127.0.0.1:80;Add below
listen *:80;
Find
server_name old.test;Change to
server_name old.localhost;
Find
allow 127.0.0.1;
deny all;Change
allow all;
##deny all;
Find and delete
location ~ .php$ {
try_files $uri =404;
include nginx.fastcgi.conf;
include nginx.redis.conf;
fastcgi_pass php_farm;
fastcgi_hide_header X-Powered-By;
}
Find
location / {
try_files $uri $uri/ =404;
}Add below
location /create_account/create_account.php {
proxy_pass http://localhost:3000/create/legacy;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}location /create/activate {
proxy_pass http://localhost:3000/create/activate;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
- Save and close
Legacy Media Files
- Extract from
legacy-media-(...).zip
the foldermedia
toC:\CPPS
- Rename the folder to
media1
and move to the folderC:\CPPS\WinNMP\WWW
- Open
WinNMP
program - In the tab
Projects
selectRefresh Projects
- In the tab
Projects
selectProject Setup - Media1
(tools icon). Will open the project setup window - Check the box
Enable Local Virtual Server
and click onEdit Nginx Virtual Server
Find
listen 127.0.0.1:80;Add below
listen *:80;
Find
server_name media1.test;Change to
server_name media1.localhost;
Find
allow 127.0.0.1;
deny all;Change
allow all;
##deny all;
- Save and close
Vanilla Play Files
- Extract from
vanilla-media-(...).zip
the folderplay
toC:\CPPS\WinNMP\WWW
- Open
WinNMP
program - In the tab
Projects
selectRefresh Projects
- In the tab
Projects
selectProject Setup - Play
(tools icon). Will open the project setup window - Check the box
Enable Local Virtual Server
and click onEdit Nginx Virtual Server
Find
listen 127.0.0.1:80;Add below
listen *:80;
Find
server_name play.test;Change to
server_name play.localhost;
Find
allow 127.0.0.1;
deny all;Change
allow all;
##deny all;
Find
location / {
try_files $uri $uri/ =404;
}Add below
location ~ ^/(.*)/penguin/create {
proxy_pass http://localhost:3000/create/vanilla/$1;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}location /penguin/create {
proxy_pass http://localhost:3000/create/vanilla/en;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}location ~ ^/(.)/penguin/activate/(.) {
proxy_pass http://localhost:3000/activate/vanilla/$1/$2;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}location ~ ^/(.*)/penguin/activate {
proxy_pass http://localhost:3000/activate/vanilla/$1;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}location /penguin/activate {
proxy_pass http://localhost:3000/activate/vanilla/en;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}location ~ ^/(.)/penguin/forgot-password/(.) {
proxy_pass http://localhost:3000/password/$1/$2;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}location ~ ^/(.*)/penguin/forgot-password {
proxy_pass http://localhost:3000/password/$1;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}location /penguin/forgot-password {
proxy_pass http://localhost:3000/password/en;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}location ^/(.*)/web-service/snfgenerator/session$ {
proxy_pass http://localhost:3000/session;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}location /api/v0.2/xxx/game/get/world-name-service/start_world_request {
proxy_pass http://localhost:3000/swrequest;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}location ~ ^/avatar/(.*)/cp$ {
proxy_pass http://localhost:3000/avatar/$1$is_args$args;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
- Save and close
Vanilla Media Files
- Extract from
vanilla-media-(...).zip
the foldermedia
toC:\CPPS\WinNMP\WWW
- Open
WinNMP
program - In the tab
Projects
selectRefresh Projects
- In the tab
Projects
selectProject Setup - Media
(tools icon). Will open the project setup window - Check the box
Enable Local Virtual Server
and click onEdit Nginx Virtual Server
Find
listen 127.0.0.1:80;Add below
listen *:80;
Find
server_name media.test;Change to
server_name media.localhost;
Find
allow 127.0.0.1;
deny all;Change
allow all;
##deny all;
Find
location / {
try_files $uri $uri/ =404;
}Add below
location /social/autocomplete/v2/search/suggestions {
proxy_pass http://localhost:3000/autocomplete;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
- Save and close
Manager
- Open
WinNMP
program - In the tab
Projects
selectNew Project
, set the name tosecured
and Save - In the tab
Projects
selectProject Setup - Secured
(tools icon). Will open the project setup window - Check the box
Enable Local Virtual Server
and click onEdit Nginx Virtual Server
Find
listen 127.0.0.1:80;Add below
listen *:80;
Find
server_name secured.test;Change to
server_name secured.localhost;
Find
allow 127.0.0.1;
deny all;Change
allow all;
##deny all;
Find
location / {
try_files $uri $uri/ =404;
}Add below
location /manager {
proxy_pass http://localhost:3000/manager;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
- Save and close
WinNMP
- Open ‘HostsEditor’
If is alredy added
127.0.0.1 old.test
127.0.0.1 media1.test
127.0.0.1 play.test
127.0.0.1 media.test
127.0.0.1 secured.testChange the host names
127.0.0.1 old.localhost
127.0.0.1 media1.localhost
127.0.0.1 play.localhost
127.0.0.1 media.localhost
127.0.0.1 secured.localhost
- Save and close
Next steps if you use legacy version.
- Dash create endpoints support Google reCAPTCHA. You require reCAPTCHA v3 keys fromhere.
- Select type:
reCAPTCHA v3
and Insert domain:old.localhost
- Create the reCAPTCHA and save the two keys in your desktop.
- Edit
C:\CPPS\WinNMP\WWW\old\index.html
,C:\CPPS\WinNMP\WWW\old\en\index.html
,C:\CPPS\WinNMP\WWW\old\es\index.html
,C:\CPPS\WinNMP\WWW\old\fr\index.html
andC:\CPPS\WinNMP\WWW\old\pt\index.html
files:
Find
data=“http://media.localhost/boots.swf”Change to
data=“http://media1.localhost/boots.swf”
Find
> *Add above* > > > > *Change the two SITE-KEY with the site key provided on the Google reCAPTCHA website.*
Next steps if you use vanilla version.
- Edit
C:\CPPS\WinNMP\WWW\play\index.html
,C:\CPPS\WinNMP\WWW\play\es\index.html
,C:\CPPS\WinNMP\WWW\play\fr\index.html
andC:\CPPS\WinNMP\WWW\play\pt\index.html
files:
Find
var media = “http://media1.clubpenguin.com/”;Change to
var media = “http://media.localhost/”;
- Edit
C:\CPPS\WinNMP\WWW\play\web_service\environment_data.xml
andC:\CPPS\WinNMP\WWW\media\play\web_service\environment_data.xml
files:
name=“play” value=“http://media.localhost/play/”
name=“client” value=“http://media.localhost/play/v2/client/”
name=“content” value=“http://media.localhost/play/v2/content/”
name=“games” value=“http://media.localhost/play/v2/games/”
name=“drupal” value=“http://play.localhost/”
name=“secured” value=“https://secured.localhost/”
name=“config” value=“http://media.localhost/play/”
Houdini
- Extract the folder from ‘houdini-(…).zip’ to
C:\CPPS
and rename to ‘houdini’ - Open the thr file
C:\CPPS\houdini\requirements.txt
Add to the top
wheel
- Run the command in this folder (CMD.exe):
pip install -r requirements.txt
- In the file
C:\CPPS\houdini\bootstrap.py
find thedatabase_group.add_argument
and change the default values if needed
database_address: localhost
database_username: postgres
database_password: password
database_name: postgres
Dash
- Extract the folder from
dash-(...).zip
toC:\CPPS
and rename todash
- Open the folder
- Run the command in this directory (CMD.exe):
pip install -r requirements.txt
- Rename the file
C:\CPPS\dash\sample.config.py
toconfig.py
- In the file
C:\CPPS\dash\config.py
find and change the default values if needed:
postgres_host = ‘localhost’
postgres_name = ‘postgres’
postgres_user = ‘postgres’
postgres_password = ‘password’
approve_username = true
legacy_activate_redirect = ‘http://old.localhost’
vanilla_activate_redirect = ‘http://play.localhost’
legacy_play_link = ‘http://old.localhost’
vanilla_play_link = ‘http://play.localhost’If you use the legacy version:
GSITE_KEY =reCAPTCHA site key for old.localhost
GSECRET_KEY =reCAPTCHA secret key for old.localhost
PostgeSQL
- Search on Google how to edit the System Variables on your Windows version
- Search in the Variables Path if is any PostgreSQL related path. If not, add to the end
;C:\CPPS\PostgreSQL\12\lib;C:\CPPS\PostgreSQL\12\bin\
( !!! \PostgreSQL\ is the folder where i install PostgreSQL and can contain a subfolder with the version number \12\)
- Save and close
- Open the folder
C:\CPPS\houdini
- Run the command in this directory (CMD.exe):
psql -h localhost -d postgres -U postgres -f houdini.sql
(password: password)
III Part - Run the Servers
WinNMP
- Open
WinNMP
, the servers Nginx and Redis should automatically start
Houdini
- Open the folder
C:\CPPS\houdini
- Run the commands in this folder (CMD.exe):
You can choose which languages you want to use.
Login server required and at least one World server.python bootstrap.py login
English world Server: python bootstrap.py world -p 9875
Spanish world Server: python bootstrap.py world -p 9876
French world Server: python bootstrap.py world -p 9878
Portuguese world Server: python bootstrap.py world -p 9877
Dash
- Open the folder
C:\CPPS\dash
- Run the commands in this folder (CMD.exe):
python bootstrap.py -c config.py
If you used this tutorial and it is working, leave a like.