updated READMEs for using gzip on NGINX
parent
19959847ef
commit
375f94ed3a
|
@ -21,26 +21,41 @@ refer to http://nginx.org/en/docs/install.html
|
|||
|
||||
* Configure NGINX
|
||||
```
|
||||
$ sudo nano /etc/nginx/nginx.conf
|
||||
$ sudo nano /etc/nginx/nginx.conf
|
||||
```
|
||||
Add another new 'server' section, add values as below:
|
||||
In the 'http' section, add some directives:
|
||||
```
|
||||
server {
|
||||
listen 8001;
|
||||
server_name myems-admin;
|
||||
location / {
|
||||
root /var/www/html/admin;
|
||||
index index.html index.htm;
|
||||
}
|
||||
-- To avoid CORS issue, use Nginx to proxy myems-api to path /api
|
||||
-- Add another location /api in 'server ', replace demo address http://127.0.0.1:8000/ with actual url
|
||||
location /api {
|
||||
proxy_pass http://127.0.0.1:8000/;
|
||||
proxy_connect_timeout 75;
|
||||
proxy_read_timeout 600;
|
||||
send_timeout 600;
|
||||
}
|
||||
}
|
||||
http{
|
||||
client_header_timeout 600;
|
||||
client_max_body_size 512M;
|
||||
gzip on;
|
||||
gzip_min_length 512;
|
||||
gzip_proxied any;
|
||||
gzip_types *;
|
||||
gzip_vary on;
|
||||
...
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
Add a new 'server' section with direstives as below:
|
||||
```
|
||||
server {
|
||||
listen 8001;
|
||||
server_name myems-admin;
|
||||
location / {
|
||||
root /var/www/html/admin;
|
||||
index index.html index.htm;
|
||||
}
|
||||
-- To avoid CORS issue, use Nginx to proxy myems-api to path /api
|
||||
-- Add another location /api in 'server ', replace demo address http://127.0.0.1:8000/ with actual url
|
||||
location /api {
|
||||
proxy_pass http://127.0.0.1:8000/;
|
||||
proxy_connect_timeout 75;
|
||||
proxy_read_timeout 600;
|
||||
send_timeout 600;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
* Download myems-admin
|
||||
|
@ -52,12 +67,12 @@ $ git clone https://github.com/MyEMS/myems.git
|
|||
* Install myems-admin :
|
||||
If the server can not connect to the internet, please compress the myems/admin folder and upload it to the server and extract it to ~/myems/admin
|
||||
```
|
||||
$ sudo cp -r ~/myems/admin /var/www/html/admin
|
||||
$ sudo chmod 0755 -R /var/www/html/admin
|
||||
$ sudo cp -r ~/myems/admin /var/www/html/admin
|
||||
$ sudo chmod 0755 -R /var/www/html/admin
|
||||
```
|
||||
Check the config file and change it if necessary:
|
||||
```
|
||||
$ sudo nano /var/www/html/admin/app/api.js
|
||||
$ sudo nano /var/www/html/admin/app/api.js
|
||||
```
|
||||
|
||||
## NOTE:
|
||||
|
|
|
@ -39,6 +39,49 @@ You can run 'node server.js' to run the production build locally at http://local
|
|||
|
||||
refer to http://nginx.org/en/docs/install.html
|
||||
|
||||
* Configure NGINX
|
||||
```
|
||||
$ sudo nano /etc/nginx/nginx.conf
|
||||
```
|
||||
In the 'http' section, add some directives:
|
||||
```
|
||||
http{
|
||||
client_header_timeout 600;
|
||||
client_max_body_size 512M;
|
||||
gzip on;
|
||||
gzip_min_length 512;
|
||||
gzip_proxied any;
|
||||
gzip_types *;
|
||||
gzip_vary on;
|
||||
...
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
Add a new 'server' section with direstives as below:
|
||||
```
|
||||
server {
|
||||
listen 80;
|
||||
server_name myems-web;
|
||||
location / {
|
||||
root /var/www/html/web;
|
||||
index index.html index.htm;
|
||||
}
|
||||
-- To avoid CORS issue, use Nginx to proxy myems-api to path /api
|
||||
-- Add another location /api in 'server ', replace demo address http://127.0.0.1:8000/ with actual url
|
||||
location /api {
|
||||
proxy_pass http://127.0.0.1:8000/;
|
||||
proxy_connect_timeout 75;
|
||||
proxy_read_timeout 600;
|
||||
send_timeout 600;
|
||||
}
|
||||
}
|
||||
```
|
||||
Restart NGINX
|
||||
```
|
||||
$ sudo systemctl restart nginx
|
||||
```
|
||||
|
||||
* Download myems:
|
||||
```
|
||||
$ cd ~
|
||||
|
@ -58,7 +101,7 @@ refer to http://nginx.org/en/docs/install.html
|
|||
```
|
||||
Install
|
||||
Upload the file myems-web.tar.gz to you web server.
|
||||
Note that the following path may be different in your server.
|
||||
Note that the following path shoudl be same as that in nginx.conf.
|
||||
```
|
||||
$ tar xzf myems-web.tar.gz
|
||||
$ sudo rm -r /var/www/html/web
|
||||
|
|
Loading…
Reference in New Issue