在CentOS下安装Ngix服务及集群PHP、Tomcat.docx

上传人:自*** 文档编号:124947847 上传时间:2020-03-14 格式:DOCX 页数:8 大小:67.87KB
返回 下载 相关 举报
在CentOS下安装Ngix服务及集群PHP、Tomcat.docx_第1页
第1页 / 共8页
在CentOS下安装Ngix服务及集群PHP、Tomcat.docx_第2页
第2页 / 共8页
在CentOS下安装Ngix服务及集群PHP、Tomcat.docx_第3页
第3页 / 共8页
在CentOS下安装Ngix服务及集群PHP、Tomcat.docx_第4页
第4页 / 共8页
在CentOS下安装Ngix服务及集群PHP、Tomcat.docx_第5页
第5页 / 共8页
点击查看更多>>
资源描述

《在CentOS下安装Ngix服务及集群PHP、Tomcat.docx》由会员分享,可在线阅读,更多相关《在CentOS下安装Ngix服务及集群PHP、Tomcat.docx(8页珍藏版)》请在金锄头文库上搜索。

1、在CentOS下安装Ngix服务及集群PHP、Tomcat一、 Ngix依赖模块安装Ngix依赖模块有:pcre、zlib、openssl、md5 /sha1(如果系统中没有安装相应模块,需要按照下列方式安装)1、 安装pcre模块(8.35)官方网站:http:/www.pcre.org/安装命令:# unzip pcre-8.35.zip# cd pcre-8.35# ./configure# make & make install 在64位linux系统中,nginx搜索的库位置为lib64;所以,需要建立软连接:# ln -s /usr/local/lib/libpcre.so.1 /

2、lib64/# ln -s /usr/local/lib/libpcre.so.1 /lib/# ln -s /usr/local/lib/libpcre.so.1 /usr/local/lib64/2、 安装zlib模块(1.2.8)官方网站:http:/ tar zxvf zlib-1.2.8.tar.gz# cd zlib-1.2.8# ./configure# make & make install3、 安装openssl模块(1.0.1h)官方网站:http:/www.openssl.org/安装命令:# tar zxvf openssl-1.0.1h.tar.gz# cd open

3、ssl-1.0.1h# ./config# make &make install二、 Nginx安装1、 安装Nginx(1.6.0)官方网站:http:/nginx.org/安装命令:# tar zxvf nginx-1.6.0.tar.gz# cd nginx-1.6.0# ./configure -prefix=/usr/local/nginx -with-openssl=/usr/local/openssl -with-http_stub_status_module# make & make install安装完成后的Nginx的目录结构:rootAP nginx-1.6.0# ll

4、/usr/local/nginx/total 16drwxr-xr-x 2 root root 4096 Jun 24 14:42 confdrwxr-xr-x 2 root root 4096 Jun 24 14:42 htmldrwxr-xr-x 2 root root 4096 Jun 24 14:42 logsdrwxr-xr-x 2 root root 4096 Jun 24 14:42 sbin2、 修改配置文件中的监听端口,确保不被其他程序占用修改配置文件:/usr/local/nginx/conf/nginx.conf修改端口:80-90902.1、设置Linux防火墙,打开端

5、口9090执行命令:# /sbin/iptables -I INPUT -p tcp -dport 9090 -j ACCEPT保存设置命令:# /etc/rc.d/init.d/iptables save查看端口打开情况命令:#/etc/init.d/iptables status重启防火墙服务# /etc/rc.d/init.d/iptables restart3、 启动、停止NginxA、 启动命令#/usr/local/nginx/sbin/nginxB、 停止命令 # /usr/local/nginx/sbin/nginx -s stopC、 检查配置文件 # /usr/local/

6、nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.confD、 查看nginx版本及完整版本# /usr/local/nginx/sbin/nginx Vnginx version: nginx/1.6.0# /usr/local/nginx/sbin/nginx Vnginx version: nginx/1.6.0built by gcc 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC)configure arguments: -prefix=/usr/local/nginx -with-openssl=/us

7、r/local/openssl -with-http_stub_status_moduleE、 查看帮助# /usr/local/nginx/sbin/nginx hnginx version: nginx/1.6.0Usage: nginx -?hvVtq -s signal -c filename -p prefix -g directivesOptions: -?,-h : this help -v : show version and exit -V : show version and configure options then exit -t : test configurati

8、on and exit -q : suppress non-error messages during configuration testing -s signal : send signal to a master process: stop, quit, reopen, reload -p prefix : set prefix path (default: /usr/local/nginx/) -c filename : set configuration file (default: conf/nginx.conf) -g directives : set global direct

9、ives out of configuration file4、 Nginx默认页面显示三、 Nginx反向代理Tomcat服务Nginx和Tomcat的整合非常的简单,只需要修改nginx.conf配置文件,添加如下信息: location /TspWebManager/ index index.html; proxy_pass http:/192.168.30.202:8001/TspWebManager/; location /CNP_MServiceProcess/ index index.html; proxy_pass http:/192.168.30.202:8001/CNP_M

10、ServiceProcess/; 说明:1、 URL正则表达式/TspWebManager/、/CNP_MServiceProcess/,当请求Nginx服务器的URL地址,和正则表达式匹配,则按照当前location中的规则进行反向代理。2、 Index默认页面3、 proxy_pass反向代理地址:这里是指向另外tomcat服务URLURL的定义,需要有一定的规则,方便Nginx的正则表达式定义、解析。本例中的2个location定义,实现的是Nginx反向代理另外一台服务器上的两种不同类型的业务服务。四、 安装PHP及Oracle客户端驱动扩展1、 安装oracle客户端A、 Oracl

11、e客户端安装官网:http:/ rpm -ivh oracle-instantclient-basic-10.2.0.5-1.x86_64.rpm# rpm -ivh oracle-instantclient-devel-10.2.0.5-1.x86_64.rpmB、 建立软连接,使得pdo_oci能够识别64位客户端# ln -s /usr/include/oracle/10.2.0.5/client64/ /usr/include/oracle/10.2.0.5/client# ln -s /usr/lib/oracle/10.2.0.5/client64/ /usr/lib/oracle

12、/10.2.0.5/client# ln -s /usr/include/oracle/10.2.0.5/ /usr/include/oracle/10.2.0.3# ln -s /usr/lib/oracle/10.2.0.5/ /usr/lib/oracle/10.2.0.3C、 配置oracle客户端库#echo /usr/lib/oracle/10.2.0.5/client/lib/ /etc/ld.so.conf.d/oracle_client.conf# /sbin/ldconfigD、 设置客户端环境参数# vi /etc/profile配置文件尾部,添加如下配置信息:expor

13、t ORACLE_HOME=/usr/lib/oracle/10.2.0.5/clientexport LD_LIBRARY_PATH=/usr/lib/oracle/10.2.0.5/client:$LD_LIBRARY_PATHexport NLS_LANG=AMERICAN_AMERICA.AL32UTF8执行命令,更新配置# source /etc/profile2、 安装re2c-0.13.6.tar.gz官网地址:http:/www.re2c.org/# tar zxvf re2c-0.13.6.tar.gz# cd re2c-0.13.6# ./configure# make & make install3、 安装PHP服务A、 安装PHP依赖包libxml2libxml2-develautoconflibjpeglibjpeg-devellibpnglibpng-develfreetypefreetype-develzlibzlib-develglibcglibc-develglib2glib2-devel 需要自行安装。B、 安装mcrypt工具官网地址:http:/ http:/

展开阅读全文
相关资源
相关搜索

当前位置:首页 > IT计算机/网络 > 计算机应用/办公自动化

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号