1. Install and start nginx# Install nginx sudo apt-get install nginx # Start sudo service nginx start Verify Installation # After the installation is complete, use nginx -v to check. If the output of nginx version information indicates that the installation is successful nginx -v # If the output is similar to this version number, the installation is complete nginx version: nginx/1.14.0 (Ubuntu) 2. Modify the nginx configuration file and deploy the project Check the configuration of nginx. The configuration files under Linux system are usually stored in the nginx directory under the /etc directory. Use the editor that comes with the connection tool to open or vim Check whether nginx configuration is correct sudo nginx -t Successful will appear.
Load nginx configuration sudo nginx -s reload If the project is configured with cross-domain API, please continue to see point 3, otherwise just go to point 4 to access the project 3. Configure the proxy APIGenerally, projects with separated front-end and back-end need to be cross-domain Or edit the /etc/nginx/sites-available/default file #The request address in the vue project needs to be preceded by api #Proxy configuration for initiating requests, all addresses containing /api are replaced and forwarded to the address under proxy_pass location /api/ { rewrite ^/b/(.*)$ /$1 break; proxy_pass http://www.ifyyf.com/; } As shown You can proxy to the original cross-domain proxy of vue.config.js 4. Access the projectOpen the server's ip or domain name to access the project 5. Secondary menu 404 problemvim opens the default file
Modified to
This is the end of this article about deploying vue projects and configuring proxies on Nginx. For more information about deploying vue projects on Nginx, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: HTML text box (text) is not available in multiple ways to achieve read-only
>>: Detailed explanation of how to use JS to achieve the effect of PS eraser scratch card in canvas
Log in to MySQL first shell> mysql --user=root...
Table of contents Event Loop miscroTask (microtas...
Introduction to jsvc In production, Tomcat should...
1. Install xshell6 2. Create a server connection ...
The following are all performed on my virtual mac...
Table of contents 1. What kind of backup is a dat...
Aggregate functions Acts on a set of data and ret...
There are many loopholes in the simple seamless s...
Here are some tips from training institutions and...
Table of contents 1. v-on directive 1. Basic usag...
In this note, we briefly describe What is the B+T...
This article example shares the specific code of ...
The effect to be achieved: When the mouse is plac...
0x0 Introduction First of all, what is a hash alg...
Preface In our daily work, we often need to renam...