@@ -54,15 +54,12 @@ Or like this: `npm --silent run gulp -- ...`.
5454
5555## 5. System packages
5656
57- You'll also need to install nginx and GraphicsMagick (for image resizing).
57+ You'll also need to install GraphicsMagick (for image resizing).
5858
5959For MacPorts, the commands are:
6060
6161```
6262sudo port install GraphicsMagick
63- sudo port install nginx +debug+gzip_static+realip+geoip
64-
65- sudo port load nginx
6663```
6764
6865## 6. npm install
@@ -73,89 +70,19 @@ In the directory with javascript-tutorial-server, run:
7370npm install
7471```
7572
76- ## 7. Configuring Nginx from scratch
77-
78- If you had no nginx before, then everything is simple.
79-
80- The logs directory is ` /var/log/nginx ` .
81-
82- Create it and set owner/permissions. For a personal computer, can do it like this:
83-
84- ```
85- mkdir /var/log/nginx
86- chmod 777 /var/log/nginx
87- ```
88-
89- Create configs by running:
90- ```
91- npm --silent run gulp -- config:nginx --prefix /opt/local/etc/nginx --root /js/javascript-tutorial-server --env development --clear
92- ```
93-
94- Here ` --prefix ` -- is the directory for nginx config, usually ` /etc/nginx ` , for MacPorts it's ` /opt/local/etc/nginx ` .
95-
96- The ` --root ` is where the server is located. If you used another path instead of ` /js/javascript-tutorial-server ` , then change it.
97-
98- The ` --clear ` option clears all configs before creating the new ones. That's fine if you had no nginx before.
99-
100- Also it's recommended to add this line to ` /etc/hosts ` :
101- ```
102- 127.0.0.1 javascript.in
103- ```
104-
105- This host name is in the Nginx config already.
106-
107- ## 7.1. If node.js is installed already
108-
109- If you already have nginx, make a backup of it's config files.
110-
111- Then execute the prevous section without the ` --clear ` at the end:
112-
113- ```
114- npm --silent run gulp -- config:nginx --prefix /opt/local/etc/nginx --root /js/javascript-nodejs --env development
115- ```
116-
117- The command copies files from the directory ` /js/javascript-tutorial-server/nginx ` into the folder ` --prefix ` , but without removing old configs.
118-
119- So if you had other sites in ` sites-enabled ` , they will not be removed.
120-
121- Rerun nginx. Make sure your existing projects work.
122-
123- ## 8. Database
124-
125- Copy the tutorial repo, for instance ` javascript-tutorial-en `
126-
127- ```
128- cd /js
129- git clone https://github.com/iliakan/javascript-tutorial-en
130- ```
131-
132- After that, import it with the command:
133- ```
134- PLUNK_REMOTE_OFF=1 npm --silent run gulp -- tutorial:import --root /js/javascript-tutorial-en
135- ```
136-
137- Here ` /js/javascript-tutorial-en ` -- the directory with the tutorial repository.
138-
139- ` PLUNK_REMOTE_OFF=1 ` disables automatic uploading of examples to plnkr.co.
140- That requires to setup a plnkr session, and is not necessary to run the tutorial.
141-
142- ## 9. Run the site
14373
74+ ## 7. Run the site
14475
14576Run the site with the language in ` NODE_LANG ` variable:
146- ```
147- HOST=127.0.0.1 PORT=80 ./dev en
148- ```
149-
150- Or with default host 127.0.0.1 and port 3000:
151-
15277```
15378./dev en
15479```
15580
156- Then access the site.
81+ Then access the site at ` http://127.0.0.1 ` .
15782
158- If you have ` 127.0.0.1 javascript.in ` in ` /etc/hosts ` , then the address will be ` http://javascript.in:3000 ` .
83+ If you have ` 127.0.0.1 javascript.local ` in ` /etc/hosts ` , then the address will be ` http://javascript.local ` .
84+
85+ Wait for a couple of seconds to build static assets.
15986
16087## 10. Run in "Edit" mode
16188
@@ -165,8 +92,6 @@ In "Edit" mode the engine watches the tutorial directory, instantly picks the ch
16592./edit en
16693```
16794
168- This uses the default ` HOST=127.0.0.1 ` , ` PORT=3000 ` , and the folder is ` /js/javascript-tutorial-en ` .
169-
17095
17196# TroubleShooting
17297
0 commit comments