前后端分离
-
AntDesign通过Nginx访问后端API的配置参考
123456789101112131415161718192021server {server_name www.test.com;#域名root G:/dist; #文件夹路径location / {# 用于配合 browserHistory使用try_files $uri $uri/ /index.html;# 如果有资源,建议使用 https + http2,配合按需加载可以获得更好的体验# rewrite ^/(.*)$ https://preview.pro.ant.design/$1 permanent;}location /api {#反向代理 如果请求的使api就代理到 修改为自己api的域名proxy_pass https://preview.pro.ant.design;proxy_set_header X-Forwarded-Proto $scheme;proxy_set_header Host $http_host;proxy_set_header X-Real-IP $remote_addr;}} -
Ubuntu安装nodejs
1234567891011121314151617181920212223242526272829303132333435sudo apt remove nodejssudo apt purge nodejssudo apt autoremovesudo apt remove npm#注意x是小写curl https://deb.nodesource.com/setup_10.x > node.shcat node.shchmod +x node.shsudo ./node.shsudo apt-get install -y nodejsnode –vnpm –vsudo npm install -g cnpm --registry=https://registry.npm.taobao.org#解决ENOSPC报错问题echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p#npm设置和取消代理的方法设置代理(例如在公司的时候)npm config set proxy=http://127.0.0.1:8087npm config set registry=http://registry.npmjs.org取消代理(例如提示蓝灯端口不可用的时候)npm config delete proxynpm config delete https-proxy#初始化react项目cd ~/devmkdir nodejscd nodejsnpx create-react-app todolist#注意:为了速度和不报错,建议用cnpm命令替代npmcnpm installcnpm start