nginx + php + https ÅäÖÃÓÃÀý
#
Æô¶¯·þÎñµÄÓû§ºÍ×é
user
lighttpd lighttpd;
#
¿ª¶àÉÙ½ø³Ì
worker_processes
2;
#
´íÎóÈÕÖ¾
error_log
/data/log/nginx/nginx_error/nginx_error.log crit;
#
pid
pid
/var/run/nginx.pid;
#
Specifies
the value for maximum file descriptors that can be opened by this
process.
worker_rlimit_nofile
51200;
events
{
use
epoll;
worker_connections
51200;
}
http
{
#
¿ªÁ½ php-cgi ·þÎñ£¬¶Ë¿ÚÁ¬½Ó·½Ê½Ëٶȿ죬socket·½Ê½Îȶ¨
#
ʹÓÃ
lighttpd µÄ spawn-fcgi ÆðµÄfast-cgi
#
weight
ÊÇÉèÖÃÈ¨ÖØ
upstream phpfastcgi
{
server
unix:/tmp/php-fastcgi0.sock weight=1;
server
unix:/tmp/php-fastcgi1.sock weight=1;
#
server 127.0.0.1:8000
weight=1;
#
server 127.0.0.1:8001 weight=1;
}
#
mime ÀàÐÍ ºÍ ĬÈÏ header-type
include
mime.types;
default_type
application/octet-stream;
#
ĬÈÏ
header-charset
charset
utf-8;
#
һЩÏÞÖÆ
server_names_hash_bucket_size
128;
client_header_buffer_size
32k;
large_client_header_buffers
4 32k;
client_max_body_size
8m;
#
sendfile
Ó¦¸ÃÊÇ lighttpd µÄ sendfile ÊÇÒ»¸öÒâ˼
sendfile
on;
tcp_nopush
on;
keepalive_timeout
60;
tcp_nodelay
on;
#
fastcgi ÅäÖÃ
fastcgi_connect_timeout
300;
fa
Ïà¹ØÎĵµ£º
<?php
//¶ÔÏó
class MyJson{
$id=1;
$site ......
phpÁ¬½Ómysql²âÊÔ´úÂ룺
$link=mysql_connect('localhost','root','123456');
if(!$link) echo "ʧ°Ü!";
else echo "³É¹¦!";
mysql_close();
?>
ÔËÐдúÂë³öÏÖ£ºCall to undefined function 'mysql_connect()'… ʧ°Ü
°Ù¶ÈÕÒµ½½á¹ûÊÇPHP+MYSQL »·¾³Ã ......
<?php
function delfile($dir,$n) //ɾ³ýDIR·¾¶ÏÂNÌìǰ´´½¨µÄËùÓÐÎļþ;
{
if(is_dir($dir))
{
if($dh=opendir($dir))
{
while (false !== ($file = readdir($dh)))
{
if($file!="." && $file!="..")
{
$fullpath=$dir."/".$file;
if(!is_dir($fullpath)) ......
ÈÎÎñ£º¸ù¾ÝÊäÈëµÄÓòÃû ͳ¼ÆÒÔÏÂÈý¸öÊý¾Ý£¬µÚÒ»£ºÈ«ÇòÅÅÃû£»µÚ¶þ£ºÓû§Á¿£¨ÔÂÆ½¾ùÖµ£©£»µÚÈý£º
È˾ùÒ³Ãæ·ÃÎÊÁ¿£¨ÔÂÆ½¾ùÖµ£©¡£
˼·£ºÊ¹ÓÃget_file_contentsÌáÈ¡³öÍøÒ³ÄÚÈÝ£¬ÔÙ¸ù¾ÝÕýÔò±í´ïʽ½øÐÐÄÚÈݵÄɸѡ¡£
ºËÐĺ¯ÊýÈçÏ£º
<?php
/*
the function of getting aleax data
@param string partten  ......
/ ok
header('HTTP/1.1 200 OK');
//ÉèÖÃÒ»¸ö404Í·:
header('HTTP/1.1 404 Not Found');
//ÉèÖõØÖ·±»ÓÀ¾ÃµÄÖØ¶¨Ïò
header('HTTP/1.1 301 Moved Permanently');
//תµ½Ò»¸öеØÖ·
header('Location: http://www.example.org/'
);
//ÎļþÑÓ³ÙתÏò:
header('Refresh: 10; url=http://www.example.org/');
print 'Y ......