A few days ago, we had to work on a project. At ordinary times is online, access can be directly through the online address, is very convenient. Isn’t that something a VPN can handle? But party A’s dad wants to do a standalone demo… What? Page is full of analog data, you can see the effect on your own computer. However, direct access to local resources is not feasible after the jump path is packaged by vUE. Is this an unsolvable problem? What a bald head…
Here’s the problem: connecting to three items locally. If you jump directly, the path is not correct, if you add HTTP, the address bar will be missing a: what the hell is this? Finally, there is no way, the company’s boss pointed out a clear way. Here, record the open road.
1. Install nginx on Windows
- Conf :nginx configuration file
- HTML: the folder where vUE is packaged
- Logs: Prints logs (after nginx is successfully started, nginx.pid file is generated)
- Nginx: start the program
2. Configure various files
- Listen: indicates the listening port number
- Root: indicates the folder name
If you have multiple files strung together, it is common to write the configuration of a project in a conf file for future maintenance
The HTML goes into the packaged file
3. Start nginx
Method 1: Double-click the nginx application and type localhost:80. Welcome to nginx! “, it indicates that the startup is successful
Method 2: CMD enter the nginx file, enter the start nginx command to start
4. Restart nGIxn
Nginx nginx -s reload is required every time the conf file is modified
5. Disable nGIxn
Nginx -s stop nginx
Method 2: Nginx -s quit(complete orderly stop nginx)
6, about the pit encountered by nginx
(1) Failed to start nginx
Solution: nginx default port 80, first check to see if port 80 occupied netstat ano | findstr searches 0.0.0.0:80 or netstat ano | findstr searches “80”
(2) Do not place under directory names with Chinese characters!!
(3) Killer trick! Restarting your computer solves most of your problems