- 论坛徽章:
- 0
|
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
log_format wwwlogs '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log /var/nginx/logs/wwwlogs.log wwwlogs;
}
server
{
listen 82;
server_name 192.168.6.253;
location / {
stub_status on;
access_log off;
}
}
}
②、在/usr/local/nginx/conf/目录中创建fcgi.conf文件:
vi /usr/local/nginx/conf/fcgi.conf
输入以下内容:
引用
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
5、启动Nginx
ulimit -SHn 51200
/usr/local/nginx/sbin/nginx
ZendOptimizer]
tar zxvf ZendOptimizer-3.3.0a-linux-glibc21-i386.tar.gz
cd ZendOptimizer-3.3.0a-linux-glibc21-i386
./install.sh
文字图形界面-同意安装协议-选择Zend安装目录-选择php.ini所在目录-不使用apache web server-installing-finished
四、配置开机自动启动Nginx + PHP
vi /etc/rc.local
在末尾增加以下内容:
引用
ulimit -SHn 51200
/usr/local/webserver/php/sbin/php-fpm start
/usr/local/nginx/sbin/nginx
--------------------------------------------------------------------------------
五、优化Linux内核参数
vi /etc/sysctl.conf
在末尾增加以下内容:
引用
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.ip_local_port_range = 5000 65000
使配置立即生效:
/sbin/sysctl -p
六、在不停止Nginx服务的情况下平滑变更Nginx配置
1、修改/usr/local/nginx/conf/nginx.conf配置文件后,请执行以下命令检查配置文件是否正确:
/usr/local/nginx/sbin/nginx -t
如果屏幕显示以下两行信息,说明配置文件正确:
the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
the configuration file /usr/local/nginx/conf/nginx.conf was tested successfully
2、这时,输入以下命令查看Nginx主进程号:
ps -ef | grep "nginx: master process" | grep -v "grep" | awk -F ' ' '{print $2}'
屏幕显示的即为Nginx主进程号,例如:
6302
这时,执行以下命令即可使修改过的Nginx配置文件生效:
kill -HUP 6302
或者无需这么麻烦,找到Nginx的Pid文件:
kill -HUP `cat /usr/local/nginx/nginx.pid`
七、编写每天定时切割Nginx日志的脚本
1、创建脚本/usr/local/nginx/sbin/cut_nginx_log.sh
vi /usr/local/nginx/sbin/cut_nginx_log.sh
输入以下内容:
引用
#!/bin/bash
# This script run at 00:00
# The Nginx logs path
logs_path="/usr/local/nginx/logs/"
mkdir -p ${logs_path}$(date -d "yesterday" +"%Y" /$(date -d "yesterday" +"%m" /
mv ${logs_path}access.log ${logs_path}$(date -d "yesterday" +"%Y" /$(date -d "yesterday" +"%m" /access_$(date -d "yesterday" +"%Y%m%d" .log
kill -USR1 `cat /usr/local/nginx/nginx.pid`
2、设置crontab,每天凌晨00:00切割nginx访问日志
crontab -e
输入以下内容:
引用
00 00 * * * /bin/bash /usr/local/nginx/sbin/cut_nginx_log.sh
pureftp 安装调试
(建立pureftp的配置文件目录)
mkdir /etc/pureftpd
tar xvf pure-ftpd-1.0.21.tar.bz2
cd pure-ftpd-1.0.21
./configure --prefix=/usr/local/pureftpd \
--with-mysql=/usr/local/mysql \
--with-quotas \
--with-cookie \
--with-virtualhosts \
--with-virtualroot \
--with-diraliases \
--with-sysquotas \
--with-ratios \
--with-ftpwho \
--with-altlog \
--with-paranoidmsg \
--with-shadow \
--with-welcomemsg \
--with-throttling \
--with-uploadscript \
--with-pam \
--with-largefile \
--with-peruserlimits \
--without-bonjour \
--with-cork \
--with-sendfile \
--with-privsep \
--with-capabilities \
--with-language=simplified-chinese \
make
make install
cd configuration-file/
chmod u+x pure-config.pl
cp pure-config.pl /usr/local/pureftpd/sbin/
cp pure-ftpd.conf /etc/pureftpd/
从网上下载pureftpd_php_manage,如果找不到,单击可以加我QQ,问我要,注明“龙族”
上传到/var/www/blog/
编辑pureftp.config.php
设置$PUREFTP_CONFIG_FILE = '/etc/pure-ftpd/db/pureftpd.conf';
为 $PUREFTP_CONFIG_FILE = '/etc/pureftpd/pure-ftpd.conf';
设置$FTP_WHO = "/usr/local/sbin/pure-ftpwho";
为$FTP_WHO = "/usr/local/pureftpd/sbin/pure-ftpwho";
设置 $DefaultUid = "ftpd"; 为你要存放用户的目录的所有者的ID或者用户名
$DefaultGid = "ftpd"; 为你要存放用户的目录的组的GID或者组名
这里主要的主要的是,这个UID和GID必须为发布apache或者nginix的后台运行的拥有者
我为这个问题查询了2天2夜,自己琢磨出来的,例如上面我设置的是www账号运行nginix
我们这样设置
usermod -g ftp www
这句话的意思是把WWW放到ftp组里面去
同时要这样设置 chmod 775 /要设置的FTP目录
否则会出现建立账号,需要手工建立目录
附mysql的配置文件
DROP TABLE IF EXISTS ftpd;
CREATE TABLE ftpd (
User varchar(16) NOT NULL default '',
status enum('0','1') NOT NULL default '0',
Password varchar(64) NOT NULL default '',
Uid varchar(11) NOT NULL default '-1',
Gid varchar(11) NOT NULL default '-1',
Dir varchar(12 NOT NULL default '',
ULBandwidth smallint(5) NOT NULL default '0',
DLBandwidth smallint(5) NOT NULL default '0',
comment tinytext NOT NULL,
ipaccess varchar(15) NOT NULL default '*',
QuotaSize smallint(5) NOT NULL default '0',
QuotaFiles int(11) NOT NULL default 0,
PRIMARY KEY (User),
UNIQUE KEY User (User)
) TYPE=MyISAM;
本人的QQ:105348557,欢迎大家互相交流!
[ 本帖最后由 zhy1899 于 2009-9-24 12:35 编辑 ] |
|