Nginx 配置域名 .conf 文件

server
  {
    listen 80;
    server_name .cfc.com www.cfc.com;      #这里是配置域名
    index index.html index.htm index.php;
    root  /data/wwwroot/chunfengchui/;    #这里是你的项目文件路径

    if (!-e $request_filename) {
      rewrite ^\/(.*)$ /index.php/$1 last;
      break;
    }

      location ~ \.php {
      # comment try_files $uri =404; to enable pathinfo
      try_files $uri =404;
      fastcgi_pass  unix:/dev/shm/php-cgi.sock;    #这里php.cgi.sock文件根据你的文件目录更改
      fastcgi_index index.php;
      include fastcgi.conf;
      set $path_info "";
      set $real_script_name $fastcgi_script_name;
      if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
        set $real_script_name $1;
        set $path_info $2;
      }  
      fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
      fastcgi_param SCRIPT_NAME $real_script_name;
      fastcgi_param PATH_INFO $path_info;
    }

    location /nginx_status {
      stub_status on;
      access_log   off;
    }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
      {
        expires      30d;
      }

    location ~ .*\.(js|css)?$
      {
        expires      12h;
      }

    access_log  /data/wwwlogs/access_nginx.log  combined;
  }


你可能感兴趣的:(Linux)