nginx系列(1):快速搭建nginx + php fastcgi系统
7月 5, 2008 – 11:24 下午nginx历吏比较短,由俄罗斯人编写,以性能卓越闻名。国内用nginx做server的公司还不多,相关的学习文档还不是很完全。边学边记,共同学习。
首先分享一下搭建nginx心得.其实在ubuntu下面建立nginx平台还是十分的简单,只不过本人用linux系统的不长以及nginx的相关文档比较少,以至在前期走了不少的弯路.
1. 测试平台: ubuntu8.04
2.安装nginx
1)sudo apt-get install nginx
2)相关路径:
conf: /etc/nginx/nginx.conf
bin: /usr/sbin/nginx
vhost: /etc/nginx/sites-enable/default
cgi-params: /etc/nginx/fastcgi-params
3)例子:建一个虚拟server
在/etc/nginx/sites-enable/default中添加以下代码
- server {
- listen 80; //端口
- server_name home.ucenter; //虚拟域名
- access_log /var/log/nginx/home.ucenter.access.log; //访问日志
- location / {
- root /home/shanfeng/workspace/ucenter-home; //size根目录
- index index.php;
- }
- location ~ \.php$ { #php fastcgi的配置
- fastcgi_pass 127.0.0.1:9000; #php fastcgi的代理端口与ip
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME /home/shanfeng/workspace/ucenter-home$fastcgi_script_name; #要处理的php文件的路径
- include /etc/nginx/fastcgi_params; #fastcgi的参数文件地址
- }
- }
2.安装php-cgi
Read the rest of this entry »