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
相关文档:
查找mysql_pconnect时在mysql帮助文档上发现的,记在这里。
web server使用php生成一个web页面的三式有以下三种:
一:把PHP作为CGI Wrapper。这种方式下,每个到达web server的请求都会导致一个php解析器进程被创建,当这个php页面执行结束时,这个php解析器进程终止。
二:
在多进程的web server中,把php作为web
se ......
php连接mysql测试代码:
$link=mysql_connect('localhost','root','123456');
if(!$link) echo "失败!";
else echo "成功!";
mysql_close();
?>
运行代码出现:Call to undefined function 'mysql_connect()'… 失败
百度找到结果是PHP+MYSQL 环境� ......
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提取出网页内容,再根据正则表达式进行内容的筛选。
核心函数如下:
/*
the function of getting aleax data
@param string partten  ......
apache:
如果采用RPM包安装,安装路径应在 /etc/httpd目录下
apache配置文件:/etc/httpd/conf/httpd.conf
Apache模块路径:/usr/sbin/apachectl
web目录:/var/www/html
如果采用源代码安装,一般默认安装在/usr/local/apache2目录下
php:
如果采用RPM包安装,安装路径应在 /etc/目录下
php的配置文件:/etc/php.ini ......