Nginx configuration learning record

Step 1 : First compress the nginx installation package to a directory with no Chinese name.

Step 2 : Then enter cmd in the upper box of the folder, open the cmd page, and then enter nginx.exe to open it.

But general nginx will default to port 80, so you need to turn off other port 80 services on your computer.

Step 3 : Then go to the nginx config directory to open the nginx.conf file.

Step 4 : Modify the default port to 81:

server {
    
    

listen 81;

server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
    
    

root html;

index index.html index.htm;

}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html

#

error_page 500 502 503 504 /50x.html;

location = /50x.html {
    
    

root html;

}

Step 5 : Write down the following configuration distribution service:

server {
    
    

listen 9001;

server_name localhost;

location ~ /eduservice/ {
    
    

proxy_pass http://localhost:8001;

}

location ~ /eduoss/ {
    
    

proxy_pass http://localhost:8002;

}

}

Step 6 : Change the access address of the previous template to the nginx address:

module.exports = merge(prodEnv, {
    
    

  NODE_ENV: '"development"',

//将前段模板的访问地址改为nginx地址======================

  BASE_API: '"http://localhost:9001"',

//=================================================

})

Original link: http://zhenyunboy.icu/?p=271

Guess you like

Origin blog.csdn.net/qq_34134299/article/details/109115619