How to deploy nginx to access projects built by vue-cli

WBOY
Release: 2023-05-15 22:25:16
forward
834 people have browsed it

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

Finally, direct address Column input port access:

How to deploy nginx to access projects built by vue-cli

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

Related labels:
source:yisu.com
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!