上一篇文章部署好了软件也都启动了,可是还是报了很多错,现在总结一下
1.输入IP地址显示服务器拒绝连接
是因为linux的防火墙没关
1:查看防火状态
systemctl status firewalld
service iptables status
2:暂时关闭防火墙
systemctl stop firewalld
service iptables stop
3:永久关闭防火墙
systemctl disable firewalld
chkconfig iptables off
2.nginx报错500
这个是因为我把前端打包的dist文件放在了root目录下,没有权限访问到,可以把nginx.conf文件的第一行改成 user root
或者把文件挪到别的文件夹,两种方法都可实现.
3.500错误解决以后,可以访问页面了,点登录又来了个405
百度查了下,去找nginx的错误日志
cd /var/local/log/nginx
vim nginx.error.log
错误日志的文件不知道你们存的哪,可以用命令找一下
sudo find / -name ‘*.log’
这样可以显示全部的log文件
发现时nginx不能发送POST请求
在nginx.conf里的location里加上这一行,就ok了
4.最后的最后,点击登录不报错了,但是没反应,最后发现自己打包的时候打成了stage的,跟nginx配置不一样(nginx配置的是prod),于是把dist删了重新用npm run build :prod打包一份上传
ok!!终于搞定了!!!
纯手打,帮到你了就,动手点个赞吧,继续工作去了