Home Operation and Maintenance Nginx How to deploy projects built by accessing vue-cli in nginx

How to deploy projects built by accessing vue-cli in nginx

May 28, 2023 pm 01:04 PM
nginx vue-cli

Projects built in history mode need to rely on background technology. The nginx reverse proxy is used here to deploy the project. The specific method is as follows:

1. Create a backend server object

upstream mixVueServer{ 
  server baidu.com;#这里是自己服务器域名 
}
Copy after login

2. Create an access port and reverse proxy rule

server { 
    listen    8082; 
    server_name localhost; 

    location / { 
      root  E:/mix_vue/dist;#定位到项目的目录 
      #index index.html index.htm; 
    try_files $uri $uri/ /index.html;#根据官网这规则配置 
    } 
  location ~ \.php${ 
    proxy_pass http://mixVueServer;#根据后端语言做反向代理处理跨域问题 
    proxy_set_header  Host  $host; 
    proxy_set_header  X-Real-IP  $remote_addr; 
  } 
   
    error_page  500 502 503 504 /50x.html; 
    location = /50x.html { 
      root  html; 
    } 
  }
Copy after login

The above is the detailed content of How to deploy projects built by accessing vue-cli in nginx. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to allow external network access to tomcat server How to allow external network access to tomcat server Apr 21, 2024 am 07:22 AM

How to allow external network access to tomcat server

What are the nginx start and stop commands? What are the nginx start and stop commands? Apr 02, 2024 pm 08:45 PM

What are the nginx start and stop commands?

How to run thinkphp How to run thinkphp Apr 09, 2024 pm 05:39 PM

How to run thinkphp

What are the differences between tomcat and nginx What are the differences between tomcat and nginx Dec 27, 2023 pm 05:07 PM

What are the differences between tomcat and nginx

Welcome to nginx!How to solve it? Welcome to nginx!How to solve it? Apr 17, 2024 am 05:12 AM

Welcome to nginx!How to solve it?

How to register phpmyadmin How to register phpmyadmin Apr 07, 2024 pm 02:45 PM

How to register phpmyadmin

How to deploy nodejs project to server How to deploy nodejs project to server Apr 21, 2024 am 04:40 AM

How to deploy nodejs project to server

How to solve the problem of nginx when accessing the website How to solve the problem of nginx when accessing the website Apr 02, 2024 pm 08:39 PM

How to solve the problem of nginx when accessing the website

See all articles