updated READMEs for using gzip on NGINX

pull/1/head
13621160019@163.com 2021-02-21 15:54:08 +08:00
parent 19959847ef
commit 375f94ed3a
2 changed files with 80 additions and 22 deletions

57
admin/README.md vendored
View File

@ -21,26 +21,41 @@ refer to http://nginx.org/en/docs/install.html
* Configure NGINX * 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 { http{
listen 8001; client_header_timeout 600;
server_name myems-admin; client_max_body_size 512M;
location / { gzip on;
root /var/www/html/admin; gzip_min_length 512;
index index.html index.htm; gzip_proxied any;
} gzip_types *;
-- To avoid CORS issue, use Nginx to proxy myems-api to path /api gzip_vary on;
-- 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; 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 * Download myems-admin
@ -52,12 +67,12 @@ $ git clone https://github.com/MyEMS/myems.git
* Install myems-admin : * 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 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 cp -r ~/myems/admin /var/www/html/admin
$ sudo chmod 0755 -R /var/www/html/admin $ sudo chmod 0755 -R /var/www/html/admin
``` ```
Check the config file and change it if necessary: 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: ## NOTE:

45
web/README.md vendored
View File

@ -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 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: * Download myems:
``` ```
$ cd ~ $ cd ~
@ -58,7 +101,7 @@ refer to http://nginx.org/en/docs/install.html
``` ```
Install Install
Upload the file myems-web.tar.gz to you web server. 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 $ tar xzf myems-web.tar.gz
$ sudo rm -r /var/www/html/web $ sudo rm -r /var/www/html/web