Chinaunix首页 | 论坛 | 博客
  • 博客访问: 446109
  • 博文数量: 104
  • 博客积分: 3016
  • 博客等级: 中校
  • 技术积分: 1992
  • 用 户 组: 普通用户
  • 注册时间: 2006-04-24 11:37
文章分类

全部博文(104)

文章存档

2009年(44)

2008年(60)

我的朋友

分类: LINUX

2009-04-11 18:44:52

系统环境:CentOS5.0
Nginx版本:0.7.47
Magento版本:1.2.0.3

    Nginx+MySQL+PHP环境是按照张宴的文章搭建的,只需作一点修改就可以让Magento跑起来
    
1、修改fcgi.conf
vi /usr/local/webserver/nginx/conf/fcgi.conf

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
修改为
#fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
#fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;


2、修改nginx.conf
mv /usr/local/webserver/nginx/conf/nginx.conf /usr/local/webserver/nginx/conf/nginx.conf.OLD
vi /usr/local/webserver/nginx/conf/nginx.conf
添加以下内容:

user  www www;
worker_processes 8;
pid        /usr/local/webserver/nginx/nginx.pid;
worker_rlimit_nofile 51200;
 
events
{
  use epoll;
  worker_connections 51200;
}
 
http
{
  include       mime.types;
  default_type  application/octet-stream;
 
  #charset  gb2312;
     
  server_names_hash_bucket_size 128;
  client_header_buffer_size 32k;
  large_client_header_buffers 4 32k;
  client_max_body_size 8m;
     
  sendfile on;
  tcp_nopush     on;
 
  keepalive_timeout 60;
 
  tcp_nodelay on;
 
  fastcgi_connect_timeout 300;
  fastcgi_send_timeout 300;
  fastcgi_read_timeout 300;
  fastcgi_buffer_size 64k;
  fastcgi_buffers 4 64k;
  fastcgi_busy_buffers_size 128k;
  fastcgi_temp_file_write_size 128k;
 
  gzip on;
  gzip_min_length  1k;
  gzip_buffers     4 16k;
  gzip_http_version 1.0;
  gzip_comp_level 2;
  gzip_types       text/plain application/x-javascript text/css application/xml;
  gzip_vary on;
 
  #limit_zone  crawler  $binary_remote_addr  10m;
server {
    listen   80;
    server_name 
    index index.html index.htm index.php;
    root  /data0/htdocs/www;
    error_log  /data1/logs/nginx_error.log;
   
    # media
    location ~* \.(png|gif|jpg|jpeg|css|js|swf|ico)$ {
        root   /data0/htdocs/www/;
        access_log off;
        expires 30d;
    }
 
    # pass the PHP scripts to FastCGI socket
    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param  SCRIPT_NAME $fastcgi_script_name;
        fastcgi_param  SCRIPT_FILENAME /data0/htdocs/www$fastcgi_script_name;
        include fcgi.conf;
    }
    location ^~ /js/proxy.php {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param  SCRIPT_NAME $fastcgi_script_name;
        fastcgi_param  SCRIPT_FILENAME  /data0/htdocs/www$fastcgi_script_name;
        include fcgi.conf;
        access_log off;
        expires 30d;
    }
    location / {
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param  SCRIPT_NAME index.php;
        fastcgi_param  SCRIPT_FILENAME /data0/htdocs/www/index.php;
        include fcgi.conf;
    }
}
}

请根据实际情况进行修改,如果按照张宴文章配置,则只需将server_name修改为你自己的域名,保存退出。
重启Nginx,使配置生效
kill -HUP `cat /usr/local/webserver/nginx/nginx.pid`


    经过以上设置,就可以使Magento跑在Nginx上了。


主要参考文章:
http://blog.s135.com/nginx_php_v4/


 
阅读(1455) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2009-11-13 12:29:25

参考这篇文章, magento在nginx下配置和性能优化。 主要是ssl的配置和优化。 http://www.tomssoft.com/node/5