This is the 12th day of my participation in the August Text Challenge.More challenges in August

preface

“The colors of August are made of gold, bright and precious; The colors of August are brewed with the sun, fragrant and brilliant.”

In the future, I wish you to adjust yourself to the best state, slowly work hard, slowly become better

The example in this article uses aliyun’s server

In general, the front end is less exposed to the server and less knowledgeable about Nginx, but we should also learn about it in order to view logs and simply deploy the front end environment. Here are some of my deployment experiences

Nginx service configuration

  1. Find the file we need to upload on the local terminal

  2. Use the Linux SCP command to upload local files to a specific directory on the Nginx server

    The typical directory for the server to place front-end resources is /usr/share/nginx/html

    Linux SCP command: SCP -r/TMP /local_dir username@servername:remote_dir

    eg: scp -r ./monitor root@servername:/usr/share/nginx/html/
    Copy the code
  3. When our files are uploaded to the server, we need to configure the Nginx service

    1. Find the configuration file of Nginx service =>> CD /etc/nginx

    2. Using the ls command, you can see a file named nginx.conf

    3. Edit the configuration file to add a new server configuration =>> vim nginx.conf

    4. Insert the following configuration in the configuration file

      801 # add new nginx Web server for monitor Server {listen 801 default_server; listen [::]:801 default_server; server_name _; # configuration directory root/usr/share/nginx/HTML/monitor /; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; # location redirect location / { try_files $uri $uri/ /index.html; } # 404 handle error_page 404/404.html; Location = /40x.html {} # error_page 500 502 503 504/50x.html; location = /50x.html { } }Copy the code
    5. Save the configuration and exit =>> esc :wq

  4. >> service Nginx reload =>> service Nginx reload

  5. Check our web page in the browser, enter the server IP+ port number in the browser

    eg: servername:801

The script to share

Share a shell script (upload.sh) that you use to upload local files to the Nginx server

So you don’t have to type in at the terminal every time

`upload.sh` ``` #! / usr/bin/expect server password set password * * spawn SCP - r. / dist [email protected]: / usr/local/nginx/HTML expect * password: "*" {send "$password\r"} # expect to interact # expect to interact #Copy the code

Nginx mining pit

Error: net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK)

I checked a lot in Google, a lot of reasons to say permission.

The final solution is:

Add proxy_max_temp_file_size 0 to location/configuration item;

Let’s go straight to the result code

location / { ... . Proxy_max_temp_file_size 0; }Copy the code

conclusion

If this article helped you, please like 👍 and follow ⭐️

If there are any errors in this article, please correct them in the comments section 🙏🙏.