当前位置: 首页 > Linux

centos7安装nginx_0

时间:2023-04-06 19:39:53 Linux

systemcat/etc/redhat-releaseCentOSLinuxrelease7.7.1908(Core)nginxinstallyumsourcerpm-ivhhttp://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpminstallyuminstall-ynginxstartsystemctlstartnginx.service直接用自己的命令启动nginx-cnginx.confpublishvuedist文件夹在/etc/nginx/nginx在.confhttp模块下添加server{listen89;root/root/lantian/projects/vueproject/dist;location/api/{proxy_passhttp://localhost:8080/;}}防火墙相关命令firewall-cmd--list-portsfirewall-cmd--zone=public--add-port=80/tcp--permanent//打开端口firewall-cmd--reload//重启firewallsystemctlstopfirewalld.service//stopfirewallsystemctldisablefirewalld.service//禁止防火墙启动验证并发布成功curl-ilocalhost:89problemPermissiondenied修改nginx为root模式vim/etc/nginx/nginx.confusernginx;更改为-->用户root;