About bugs in nginx use

one: 

报错:nginx: [emerg] WSASocketW() failed (10022: An invalid argumentwas supplied)

Deploy the project like using WinSCP, use your computer as a server and put the front-end compressed package dist, so that everyone in the intranet-LAN ​​can access the front-end page

First put the nginx folder on the C drive

Configure the nginx.conf file, and write the root of the server configuration: find the file directory where the front-end compressed package needs to be placed and write it

Search for nginx in the task manager process column and close all nginx services

Enter cmd in the address bar of the nginx folder just placed on the C drive to open the window, and type nginx.exe to start

two,

nginx error 404 not found 

Remove the # number from the routing hash mode : When connecting with a third party, the other party requests to spell the url of their own webpage on their website, but the path of their own webpage is not recognized by the other party with #, and the hash mode of Vue is used. We are routing In the configuration, change the mode to history, and then remove # to solve the problem. In fact, transcoding the other party's decoding url can also solve this problem.

VUE routing removes "#"

The modification is completed, and it is packaged to the server nginx to parse the dist file and report an error, saying that the target resource token'>' cannot be found

Nginx rewrite function rewrite_nginx rewrite_lin Lin.'s Blog-CSDN Blog

The solution is to add the code at rewrite below 

 But the elementui icon is not displayed after the nginx configuration project is opened.

 

https://bbs.csdn.net/topics/393535400 

When nginx deploys the vue project, the new window page reports an error 404 (avoid entering the pit) | Programmer Sought

Finally, the try_file method was used instead, and the problem was solved

 final version


#Redirect after page refresh
try files $uri $uri/ /index.html $uri.html $uri.htm =404;

pay attention to the path

3. Try_files $uri $uri/ /index.html; After writing, Nginx returns an error of 500 using try_files - Click to receive 

Nginx deploys the vue home page to access normally, and other pages refresh to display 404_vue3 nginx only the home page can be refreshed - CSDN Blog

Finally, a digression, how to open the html file in the vue project

https://www.cnblogs.com/kebaoye/p/15970258.html

 Like accessing the above picture http://localhost:8989/static/img/userB.png Access the html path: http://localhost:8989/static/testJs.html

page jump

 <a href="/static/testJs.html">Jump</a>

报错: [emerg] unknown directive "? in C:ginx-120.1/conf/nginx.conf:2ginx:nginx: co

Solution

One more thing, root can be written inside and outside the localtion, the important thing is that it cannot exist at the same time

Guess you like

Origin blog.csdn.net/aZHANGJIANZHENa/article/details/131042611