免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2860 | 回复: 7
打印 上一主题 下一主题

[Web] nginx莫名其妙的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-05-14 18:58 |只看该作者 |倒序浏览
本帖最后由 linuxdiy 于 2010-05-14 19:36 编辑

80和9000端口都启动起来了的,还是不支持php,求解

nginx.conf内容如下
  1. user  www www;

  2. worker_processes 8;

  3. #error_log  /data1/logs/nginx_error.log  crit;

  4. pid        /usr/local/nginx/nginx.pid;

  5. #Specifies the value for maximum file descriptors that can be opened by this process.
  6. worker_rlimit_nofile 65535;

  7. events
  8. {
  9.   use epoll;
  10.   worker_connections 65535;
  11. }

  12. http
  13. {
  14.   include       mime.types;
  15.   default_type  application/octet-stream;

  16.   #charset  gb2312;
  17.       
  18.   server_names_hash_bucket_size 128;
  19.   client_header_buffer_size 32k;
  20.   large_client_header_buffers 4 32k;
  21.   client_max_body_size 8m;
  22.       
  23.   sendfile on;
  24.   tcp_nopush     on;

  25.   keepalive_timeout 60;

  26.   tcp_nodelay on;

  27.   fastcgi_connect_timeout 300;
  28.   fastcgi_send_timeout 300;
  29.   fastcgi_read_timeout 300;
  30.   fastcgi_buffer_size 64k;
  31.   fastcgi_buffers 4 64k;
  32.   fastcgi_busy_buffers_size 128k;
  33.   fastcgi_temp_file_write_size 128k;

  34.   gzip on;
  35.   gzip_min_length  1k;
  36.   gzip_buffers     4 16k;
  37.   gzip_http_version 1.0;
  38.   gzip_comp_level 2;
  39.   gzip_types       text/plain application/x-javascript text/css application/xml;
  40.   gzip_vary on;

  41.   #limit_zone  crawler  $binary_remote_addr  10m;

  42.   server
  43.   {
  44.     listen       80;
  45.     server_name  127.0.0.1;
  46.     index index.html index.htm index.php;
  47.     root  /var/www/test;

  48.     #limit_conn   crawler  20;   
  49.                              
  50.     location ~ .*\.(php|php5)?$
  51.     {      
  52.       #fastcgi_pass  unix:/tmp/php-cgi.sock;
  53.       fastcgi_pass  127.0.0.1:9000;
  54.       fastcgi_index index.php;
  55.       include fcgi.conf;
  56.     }
  57.    
  58.     location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  59.     {
  60.       expires      30d;
  61.     }

  62.     location ~ .*\.(js|css)?$
  63.     {
  64.       expires      1h;
  65.     }   

  66.     log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
  67.               '$status $body_bytes_sent "$http_referer" '
  68.               '"$http_user_agent" $http_x_forwarded_for';
  69.     #access_log  /data1/logs/access.log  access;
  70.       }


  71.   server
  72.   {
  73.     listen  80;
  74.     server_name  localhost;

  75.     location / {
  76.     stub_status on;
  77.     access_log   off;
  78.     }
  79.   }
  80. }
复制代码
php-fpm.conf内容如下
  1. <?xml version="1.0" ?>  
  2. <configuration>  
  3.   
  4.   All relative paths in this config are relative to php's install prefix  
  5.   
  6.   <section name="global_options">  
  7.   
  8.     Pid file  
  9.     <value name="pid_file">/usr/local/php/logs/php-fpm.pid</value>  
  10.   
  11.     Error log file  
  12.     <value name="error_log">/usr/local/php/logs/php-fpm.log</value>  
  13.   
  14.     Log level  
  15.     <value name="log_level">notice</value>  
  16.   
  17.     When this amount of php processes exited with SIGSEGV or SIGBUS ...  
  18.     <value name="emergency_restart_threshold">10</value>  
  19.   
  20.     ... in a less than this interval of time, a graceful restart will be initiated.  
  21.     Useful to work around accidental curruptions in accelerator's shared memory.  
  22.     <value name="emergency_restart_interval">1m</value>  
  23.   
  24.     Time limit on waiting child's reaction on signals from master  
  25.     <value name="process_control_timeout">5s</value>  
  26.   
  27.     Set to 'no' to debug fpm  
  28.     <value name="daemonize">yes</value>  
  29.   
  30.   </section>  
  31.   
  32.   <workers>  
  33.   
  34.     <section name="pool">  
  35.   
  36.       Name of pool. Used in logs and stats.  
  37.       <value name="name">default</value>  
  38.   
  39.       Address to accept fastcgi requests on.  
  40.       Valid syntax is 'ip.ad.re.ss:port' or just 'port' or '/path/to/unix/socket'  
  41.       <value name="listen_address">127.0.0.1:9000</value>  
  42.   
  43.       <value name="listen_options">  
  44.   
  45.         Set listen(2) backlog  
  46.         <value name="backlog">-1</value>  
  47.   
  48.         Set permissions for unix socket, if one used.  
  49.         In Linux read/write permissions must be set in order to allow connections from web server.  
  50.         Many BSD-derrived systems allow connections regardless of permissions.  
  51.         <value name="owner"></value>  
  52.         <value name="group"></value>  
  53.         <value name="mode">0666</value>  
  54.       </value>  
  55.   
  56.       Additional php.ini defines, specific to this pool of workers.  
  57.       <value name="php_defines">  
  58.         <value name="sendmail_path">/usr/sbin/sendmail -t -i</value>  
  59.         <value name="display_errors">1</value>  
  60.       </value>  
  61.   
  62.       Unix user of processes  
  63.         <value name="user">www</value>  
  64.   
  65.       Unix group of processes  
  66.         <value name="group">www</value>  
  67.   
  68.       Process manager settings  
  69.       <value name="pm">  
  70.   
  71.         Sets style of controling worker process count.  
  72.         Valid values are 'static' and 'apache-like'  
  73.         <value name="style">static</value>  
  74.   
  75.         Sets the limit on the number of simultaneous requests that will be served.  
  76.         Equivalent to Apache MaxClients directive.  
  77.         Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi  
  78.         Used with any pm_style.  
  79.         <value name="max_children">128</value>  
  80.   
  81.         Settings group for 'apache-like' pm style  
  82.         <value name="apache_like">  
  83.   
  84.           Sets the number of server processes created on startup.  
  85.           Used only when 'apache-like' pm_style is selected  
  86.           <value name="StartServers">20</value>  
  87.   
  88.           Sets the desired minimum number of idle server processes.  
  89.           Used only when 'apache-like' pm_style is selected  
  90.           <value name="MinSpareServers">5</value>  
  91.   
  92.           Sets the desired maximum number of idle server processes.  
  93.           Used only when 'apache-like' pm_style is selected  
  94.           <value name="MaxSpareServers">35</value>  
  95.   
  96.         </value>  
  97.   
  98.       </value>  
  99.   
  100.       The timeout (in seconds) for serving a single request after which the worker process will be terminated  
  101.       Should be used when 'max_execution_time' ini option does not stop script execution for some reason  
  102.       '0s' means 'off'  
  103.       <value name="request_terminate_timeout">0s</value>  
  104.   
  105.       The timeout (in seconds) for serving of single request after which a php backtrace will be dumped to slow.log file  
  106.       '0s' means 'off'  
  107.       <value name="request_slowlog_timeout">0s</value>  
  108.   
  109.       The log file for slow requests  
  110.       <value name="slowlog">logs/slow.log</value>  
  111.   
  112.       Set open file desc rlimit  
  113.       <value name="rlimit_files">65535</value>  
  114.   
  115.       Set max core size rlimit  
  116.       <value name="rlimit_core">0</value>  
  117.   
  118.       Chroot to this directory at the start, absolute path  
  119.       <value name="chroot"></value>  
  120.   
  121.       Chdir to this directory at the start, absolute path  
  122.       <value name="chdir"></value>  
  123.   
  124.       Redirect workers' stdout and stderr into main error log.  
  125.       If not set, they will be redirected to /dev/null, according to FastCGI specs  
  126.       <value name="catch_workers_output">yes</value>  
  127.   
  128.       How much requests each process should execute before respawn.  
  129.       Useful to work around memory leaks in 3rd party libraries.  
  130.       For endless request processing please specify 0  
  131.       Equivalent to PHP_FCGI_MAX_REQUESTS  
  132.       <value name="max_requests">102400</value>  
  133.   
  134.       Comma separated list of ipv4 addresses of FastCGI clients that allowed to connect.  
  135.       Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi (5.2.2+)  
  136.       Makes sense only with AF_INET listening socket.  
  137.       <value name="allowed_clients">127.0.0.1</value>  
  138.   
  139.       Pass environment variables like LD_LIBRARY_PATH  
  140.       All $VARIABLEs are taken from current environment  
  141.       <value name="environment">  
  142.         <value name="HOSTNAME">$HOSTNAME</value>  
  143.         <value name="PATH">/usr/local/bin:/usr/bin:/bin</value>  
  144.         <value name="TMP">/tmp</value>  
  145.         <value name="TMPDIR">/tmp</value>  
  146.         <value name="TEMP">/tmp</value>  
  147.         <value name="OSTYPE">$OSTYPE</value>  
  148.         <value name="MACHTYPE">$MACHTYPE</value>  
  149.         <value name="MALLOC_CHECK_">2</value>  
  150.       </value>  
  151.   
  152.     </section>  
  153.   
  154.   </workers>  
  155.   
  156. </configuration>  
复制代码

论坛徽章:
0
2 [报告]
发表于 2010-05-15 12:20 |只看该作者
不是吧,没一个高手解答

论坛徽章:
0
3 [报告]
发表于 2010-05-17 05:53 |只看该作者
#fastcgi_pass  unix:/tmp/php-cgi.sock;
把这句前面的#号去掉看看效果如何??

论坛徽章:
0
4 [报告]
发表于 2010-05-17 08:42 |只看该作者
fcgi.conf你把这里面的内容贴出来看一下,我怀疑你少了一个行配置
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

论坛徽章:
0
5 [报告]
发表于 2010-05-18 15:17 |只看该作者
回复 4# liuhanzhao


    感谢蚊子兄,就是少了这一句,再次感谢,激动阿,嘿嘿

论坛徽章:
0
6 [报告]
发表于 2010-05-19 12:05 |只看该作者
蚊子兄、、、、无语了。

论坛徽章:
0
7 [报告]
发表于 2010-05-22 22:24 |只看该作者
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

论坛徽章:
0
8 [报告]
发表于 2010-06-08 11:10 |只看该作者
哈哈  吸血
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP