brew install nginx Apple Mac uses brew to install. If brew is not installed, please search elsewhere. The first step is of course to update our brew library, which can be considered a software warehouse, similar to the Android Market and Apple AppStore. brew update The second step is to directly find out whether there is nginx in our brew library brew search nginx If it appears, it proves that the library is already there, and you can directly run the installation command brew install nginx As long as there is no error after the installation, your nginx has been installed successfully. . . Nginx corresponding path in mac environment First of all, we must know the common paths of our nginx. I have listed them
Edit the nginx.conf file corresponding to nginx, corresponding to the configuration path we mentioned above #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; client_body_buffer_size 10m; client_max_body_size 20m; #gzip on; server { listen 80; server_name localhost; location / { root /usr/local/etc/nginx/servers/html; index index.html; try_files $uri $uri/ /index.html; } location /api { proxy_pass http://localhost:18080/api; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; set $Real $http_x_forwarded_for; if ( $Real ~ (\d+)\.(\d+)\.(\d+)\.(\d+),(.*) ){ set $Real $1.$2.$3.$4; } proxy_set_header X-Real-Ip $Real; } } There is one detail that needs special attention. If your root is not an absolute path, you may not be able to access it. Most of the paths on the Internet are relative. I don't know what the problem is. It doesn't work locally. I have to use an absolute path. The server/html thing in the path above is the dist package of your vue project after the npm run build command. Just unzip it and put it in this path. The name must correspond to the path of your nginx configuration file. The final ending Finally, start nginx and enter the terminal command directly nginx If you want to specify the nginx.conf file you started nginx -c / followed by the path Stop nginx nginx -s stop Restart nginx nginx -s reload This is the end of this article about installing nginx on Apple M1 chip and deploying vue project. For more information about installing nginx on Apple M1 chip and deploying vue project, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! |
<<: Two usages of iFrame tags in HTML
>>: A brief discussion on whether CSS animation will be blocked by JS
The concept of lock ①. Lock, in real life, is a t...
Table of contents 1. Demand 2. Implementation 3. ...
Table of contents Preface Several common bit oper...
They are all web page templates from the foreign ...
Preface As we all know, by default, the MySQL ins...
In web design, it is very important to use an org...
Preface When developing a project, I encountered ...
Introduction Describes the use cases and solution...
This article describes how to use docker to deplo...
Whether it is the background image or the text siz...
First, let’s take a look at a CSS carousel animat...
clear:both is used to清除浮動This is the impression I...
In the trend of gradual transition from tradition...
Enter /usr/local/nginx/conf sudo cd /usr/local/ng...
Table of contents 1. Download JDK (take jdk1.8.0 ...