hhstore / blog

My Tech Blog: about Mojo / Rust / Golang / Python / Kotlin / Flutter / VueJS / Blockchain etc.
https://github.com/hhstore/blog/issues
295 stars 24 forks source link

Nginx: FAQ #280

Open hhstore opened 3 years ago

hhstore commented 3 years ago

related:

hhstore commented 3 years ago

Nginx 一些常见使用问题 FAQ:

Q1: react-router 的 页面内路由, 404报错:

 server {  
   server_name xxx.xxxxxx.com;  
   location / {  
     root /xxx/xxx/xxx/www/build;  
     try_files $uri /index.html;  
   }  
   location ^~ /api/ {  
     proxy_pass http://11.11.11.11:1111/;(服务端接口做代理)  
   }  
}   

nginx log:

tail -f /var/log/nginx/nginx.log

重新加载 nginx 配置:

# 验证配置正确性:
nginx -t

# 重新加载: 
service nginx reload

# 重启: 
service nginx restart

ref: