然Tomcat安装:在cathout.sh里配置好jdk路径然后chmod777startup.shshutdown.shcathout.sh最后./startup.sh简介:是一个服务器也可以用来做负载均衡及反向代理使用,目前使用最多的就是负载均衡一、浏览器访问路径:http://192.168.12.11/http://192.168.12.10/12.11安装路径:/usr/local/nginx12.10安装路径:/usr/local/nginx二、常用命令:启动:停止重新加载:、验证配置文件是否合法:命令帮助:三、安装步骤:下载及相关组件省略安装内容省略安装内容省略安装内容省略安装内容安装C++编译环境,如已安装可略过省略安装内容期间会有确认提示输入回车省略安装内容安装及相关组件:依赖包安装顺序依次为安装包openssl安装:省略安装内容省略安装内容zlib安装:省略安装内容省略安装内容pcre安装:省略安装内容省略安装内容nginx安装:省略安装内容省略安装内容安装完成后,可启动nginx;通过访问localhost看到这个就安装完毕了通过浏览器访问:*3iaio492ocQ冠A#Welcometonginx![fyouseeth£page,thenginxwebserverimsuccessfullyinstalledandworking.Fuitherconfiguratioriisrequired,Foronlinedocumentation.&ndsupportpleaserefertonginx.org.Commerc[alsupportIsavailableatnoin黑.5】.Thsnkyouforusingnginx.看到这个就说明安装并启动咸功问题:若进入nginx目录并启动[root@localliostnginx-1.10.2]#cd/usr/local/nginx/[root@lacalhostnginx]#|/usr/local/nginx/sbln/nginx/usr/local/nginx/sbin/nginx:errorwhiLeLoadingsharedlibraries:libpcre.so.1:cannotopenshctory在哪里命令做个软连接就可以扌报错了,errorwhileloadingsharedlibraries:libpcre.so.1:cannotopensharedobjectfile:Nosuchfileordirectory,按照下面方式解决:用命令找到用用启动用查看状态后续配置:1、简单配置Nginx打开nginx配置文件位于nginx目录下的conf文件夹下[rootg'localhostnginx]#vim匚onf/nginx.匚onf简单介绍一下vim的语法默认打开后是不能录入的,需要按键才能操作,具体如下:开启编辑:按“”或者“”键退出编辑:“”键退出:“”保存:“”保存退出:“”不保存退出:“”“#"代表注释,最重要的是server{}块这部分就代表每一个web站点,详细的配置介绍可以查阅我的另一片配置文章,此处我们先暂时设置三个站点[rootglocalhostnginx]#|whereislibpcre.so.1libpcre.so:/~LibB4/l.ibpm「e.so,0,1/usr/local/lib/libpcre.so[ro□tgocalhostnginx]#|~Ln-s/usr7~Loum~L/~Lib/~Libpu「E.go.1[raotialocalliostnginx]#sbin/nginx[root@localhostnginx]#--aux|grepnginxWarning:badsyntaxTperhaps-abogus'-'Ysee/usr/share/doc/procps-3.2.8/FAQroot346460.00.0203846481Ss01:590:00nginx:masterprocesssbin/nginxnobody346470.00.12080412281S01:590:00nginx:workerprocess分别使用不同的端口80、81、82保存退出并且重启nginx[root@'localhostnginx]#sbin/nginx-sreload2、开启外网访问在Linux系统中默认有防火墙Iptables管理者所有的端口,只启用默认远程连接22端口其他都关闭,咱们上面设置的80等等也是关闭的,所以我们需要先把应用的端口开启方法一直接关闭防火墙,这样性能较好,但安全性较差,如果有前置防火墙可以采取这种方式关闭防火墙关闭开机自启动防火墙面是防火墙的其他操作命令]]]]]]]][root@Iocalhostnginx]#serviceiptaElesstatusiptables:Firewallisnot「unning,[root@localhiostnginx]#[serviceiptaElesstartiptables:Applyingfi「ewm~LlRJIES:[root(31ocalhiostnginx]#[serviceiptaElesrestartiptables:Settingchainstopolic:¥ACCEPT:filteriptables:Flushingfirewallrules:iptables:Unloadingmodules:iptables:Applyingfi「ewm~Llrules:[root@localhostnginx]#serviceiptaElesstopiptables:SettingchainstopolicyACCEPT:filteriptables:Flushingfirewallrules:iptables:Unloadingmodules:方法二将开启的端口加入防火墙白名单中,这种方式较安全但性能也相对较差编辑防火墙白名单增加下面一行代码保存退出,重启防火墙[rootglocalhostnginx]#Ivim/et匚/gyg匚onfig/i...