diff --git a/admin/README.md b/admin/README.md index dd3d1f41..504d0277 100644 --- a/admin/README.md +++ b/admin/README.md @@ -105,8 +105,8 @@ Add a new 'server' section with direstives as below: 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 + ## To avoid CORS issue, use Nginx to proxy myems-api to path /api + ## Add another location /api in 'server' and 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; @@ -119,6 +119,8 @@ Add a new 'server' section with direstives as below: * 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 ```bash +sudo mkdir /var/www +sudo mkdir /var/www/html sudo cp -r myems/admin /var/www/html/admin sudo chmod 0755 -R /var/www/html/admin ``` diff --git a/myems-api/README.md b/myems-api/README.md index c3f23a4f..afca0100 100644 --- a/myems-api/README.md +++ b/myems-api/README.md @@ -33,9 +33,9 @@ python-decouple ```bash cd myems/myems-api -pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com +sudo pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com cp example.env .env -chmod +x run.sh +sudo chmod +x run.sh ./run.sh ``` @@ -110,50 +110,50 @@ In this section, you will online install myems-api on Ubuntu Server with interne * Copy source code to a production Ubuntu Server and then install tools ```bash cd myems/myems-api -pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com +sudo pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com ``` * Install myems-api service: ```bash -cp -r myems/myems-api /myems-api +sudo cp -r myems/myems-api /myems-api ``` Create .env file based on example.env and edit the .env file if needed: ```bash -cp /myems-api/example.env /myems-api/.env -nano /myems-api/.env +sudo cp /myems-api/example.env /myems-api/.env +sudo nano /myems-api/.env ``` Check or change the listening port (default is 8000) in myems-api.service and myems-api.socket: ```bash -nano /myems-api/myems-api.service +sudo nano /myems-api/myems-api.service ``` ```bash ExecStart=/usr/local/bin/gunicorn -b 0.0.0.0:8000 --pid /run/myems-api/pid --timeout 600 --workers=4 app:api ``` ```bash -nano /myems-api/myems-api.socket +sudo nano /myems-api/myems-api.socket ``` ```bash ListenStream=0.0.0.0:8000 ``` Add port to firewall: ```bash -ufw allow 8000 +sudo ufw allow 8000 ``` Setup systemd configure files: ```bash -cp /myems-api/myems-api.service /lib/systemd/system/ -cp /myems-api/myems-api.socket /lib/systemd/system/ -cp /myems-api/myems-api.conf /usr/lib/tmpfiles.d/ +sudo cp /myems-api/myems-api.service /lib/systemd/system/ +sudo cp /myems-api/myems-api.socket /lib/systemd/system/ +sudo cp /myems-api/myems-api.conf /usr/lib/tmpfiles.d/ ``` Next enable the services so that they autostart at boot: ```bash - systemctl enable myems-api.socket - systemctl enable myems-api.service +sudo systemctl enable myems-api.socket +sudo systemctl enable myems-api.service ``` Start the services : ```bash -systemctl start myems-api.socket -systemctl start myems-api.service +sudo systemctl start myems-api.socket +sudo systemctl start myems-api.service ``` ### Option 3: Offline install myems-api on Ubuntu Server without internet access diff --git a/web/README.md b/web/README.md index 2c46c3c3..822e5c5d 100644 --- a/web/README.md +++ b/web/README.md @@ -130,7 +130,7 @@ refer to http://nginx.org/en/docs/install.html * Configure NGINX ```bash -nano /etc/nginx/nginx.conf +sudo nano /etc/nginx/nginx.conf ``` In the 'http' section, add some directives: ``` @@ -158,8 +158,8 @@ Add a new 'server' section with direstives as below: # add try_files directive to avoid 404 error while refreshing pages try_files $uri /index.html; } - -- 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 + ## To avoid CORS issue, use Nginx to proxy myems-api to path /api + ## Add another location /api in 'server' and 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;