设为首页收藏本站

LUPA开源社区

 找回密码
 注册
文章 帖子 博客
LUPA开源社区 首页 业界资讯 技术文摘 查看内容

在CentOS 5.6 中安装 Nginx + PHP5 + MySQL

2012-4-19 13:38| 发布者: 红黑魂| 查看: 6363| 评论: 0

摘要: nginx是俄罗斯开发人员开发的web服务器软件,其特点是运行速度快,占用内存小,CPU低消耗,使用迅速在web服务器市场上占领了一席之地,现在nginx已经成立了一家专门的公司。在本教程中使用主机名server1.example.com ...

配置nginx的:
vi /etc/nginx/nginx.conf

配置是很容易理解(你可以了解它在这里:http://wiki.codemongers.com/NginxFullExamplehttp://wiki.codemongers.com/NginxFullExample2
改变一下内容:

[...]
worker_processes 5;
[...]
keepalive_timeout 2;
[...]

虚拟主机配置。让我们如下修改默认的虚拟主机 :

[...]
server {
listen 80;
server_name _;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}

error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}

# deny access to .htaccess files, if Apache’s document root
# concurs with nginx’s one
#
location ~ /\.ht {
deny all;
}
}
[...]

现在保存文件,重新启动nginx的:

/etc/init.d/nginx restart
创建一个探针文件:info.php,看看那些模块正常运行了
vi /usr/share/nginx/html/info.php
内容如下:

《?php
phpinfo();
?》

把双引号改为英文半角输入的单引号。
然后浏览器输入:http://192.168.0.100/info.php查看运行结果:

继续往下浏览,看看MYSQL运行情况:

相关软件连接:

本文采用CC协议发布,转载请注明: 转载自IMCN


酷毙

雷人

鲜花

鸡蛋

漂亮
  • 快毕业了,没工作经验,
    找份工作好难啊?
    赶紧去人才芯片公司磨练吧!!

最新评论

关于LUPA|人才芯片工程|人才招聘|LUPA认证|LUPA教育|LUPA开源社区 ( 浙B2-20090187 浙公网安备 33010602006705号   

返回顶部