手机版
你好,游客 登录 注册
背景:
阅读新闻

搭建Nginx+PHP环境

[日期:2013-03-05] 来源:Linux社区  作者:loofeer [字体:大 中 小]

搭建Nginx+PHP环境
 
一. 源码包编译安装部署web服务器
 
1.安装nginx必须的依赖包
 
[root@test01 ~]# yum -y install gcc openssl-devel pcre-devel zlib-devel
 
2.安装编译nginx,目前系统测试环境为CentOS6.3 软件版本为nginx-1.2.6
 
[root@test01 ~]# useradd nginx -s /sbin/nologin
 
[root@test01 ~]# tar zxvf nginx-1.2.6.tar.gz
 
[root@test01 ~]# cd nginx-1.2.6
 
[root@test01 nginx-1.2.6]# ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx/ --with-http_stub_status_module --with-http_ssl_module 

// --with-http_stub_status_module 安装允许状态模块
 
// --with-http_ssl_module 安装ssl模块
 
[root@test01 ~]# /usr/local/nginx/sbin/nginx -v //查看Nginx的相关环境配置信息是否正确
 
nginx version: nginx/1.2.6
 
[root@test01 ~]#
 
[root@test01 nginx-1.2.6]# make & make install  //编译安装过程略
 
 
 
3.通过nginx自身脚本机器nginx服务器,并通过各种命令查看是否启动成功
 
[root@test01 ~]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf  // -c指向nginx主配置文件
 
[root@test01 ~]# lsof -i :80 //查看nginx进程号及运行情况
 
COMMAND  PID USER  FD  TYPE DEVICE SIZE/OFF NODE NAME
 
nginx  21910 root    9u IPv4 262148      0t0 TCP *:http (LISTEN)
 
nginx  21911 nginx    9u IPv4 262148      0t0 TCP *:http (LISTEN)

[root@test01 ~]# ps -ef | grep nginx //查看nginx进程号及运行情况
 
root    21910    1 0 10:41 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
 
nginx    21911 21910 0 10:41 ?        00:00:00 nginx: worker process         

root    21957 21755 0 10:42 pts/0    00:00:00 grep nginx

[root@test01 ~]# netstat -nltp | grep 80 //查看nginx进程监听端口
 
[root@test01 ~]# netstat -an |grep 80
 
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                  LISTEN

4.通过windows服务器IE浏览器测试
 

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款