首页 > 编程知识 正文

centos7配置网卡ip,centos启动nginx

时间:2023-05-04 21:45:42 阅读:126596 作者:4330

tomcat安装

安装nginx

配置nginx

nginx的默认安装目录/etc/nginx

配置文件时nginx.conf

新配置式(假设需要部署的站点是qqq.baidu.com) ) ) ) ) ) ) ) )。

vim/etc/nginx/conf.d/qqq.Baidu.com.conf

服务器{

#监听端口

listen 80

#站点名称

server_name qqq.baidu.com;

#站点根目录

根/万维网/

位置/{

#默认主页配置

index index.html;

}

}

vim/etc/nginx/conf.d/proxy _ qqq.Baidu.com.conf

服务器{

#监听端口

listen 80

#站点名称

server_name qqq.baidu.com;

位置/{

#可访问的站点ip :端口或域名: ip

proxy _ pass http://192.168.72.15633608080;

}

}

启动nginx

systemctlstartfirewalld.service

启动时报告错误查看错误日志后,根据错误内容自己百度

systemctl status nginx.service

启动后访问目标站点时,显示错误403。 请参照以下内容

负载平衡配置

后缀conf就可以了。 效果和写在nginx.conf的http上的一样

创建编辑文件qqq.baidu.com.conf

vim/etc/nginx/conf.d/qqq.Baidu.com.confupstreamtomcatserver1{ server 192.168.72.1563:8080; 服务器192.168.72.156:8081; }server { listen 80; server_name qqq.baidu.com; location/{proxy_pass3358Tomcat服务器1; 索引索引. html index.htm; }重新启动服务后,将获得负载平衡的效果

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。