首页 > L.A.M.P > 近期配置 linux 服务器的一点备注

近期配置 linux 服务器的一点备注

2010年9月10日 发表评论 阅读评论

一、PHP.ini

某个客户我配置好以后反映无法上传文件,具体表现为 $_FILES[‘abc’][‘tmp_name’] 为空。判断是没有临时文件夹的权限造成的。几番检查最后发现原来是 php.ini 中的 open_basedir 没有把 PHP 默认存放临时文件用的 /tmp/ 文件夹添加进去,补上后问题解决。

二、sed 命令

在编写一个用于开设新站点的 shell 脚本时,碰到使用 sed 命令修改配置文件的命令行始终无法调用脚本变量的问题。最终在网上偶然看到原因,原来要用双引号。
sed -i “s/newdomain/${2}/g” /etc/nginx/conf/vhost/$1.conf

三、用于开设新站点用的 shell 脚本。(初学练手,待完善)

#!/bin/sh

if [ -z $1 ]; then
    echo “no folder name!”
    exit 0
fi

if [ -z $2 ]; then
    echo “no domain!”
    exit 0
fi

if [ -z $3 ]; then
    echo “no ftp password!”
    exit 0
fi

if [ -f /srv/http/$1 ]; then
    echo “The $1 has exists!”
    exit 0
fi

# for web
mkdir /srv/http/$1
chown -R http:http /srv/http/$1
chmod -R 777 /srv/http/$1
cp /etc/nginx/conf/vhost.conf /etc/nginx/conf/vhost/$1.conf
sed -i “s/vhost/${1}/g” /etc/nginx/conf/vhost/$1.conf
sed -i “s/newdomain/${2}/g” /etc/nginx/conf/vhost/$1.conf
echo “” > /srv/http/$1/index.php

# for ftp
echo $1 >> /etc/vsftpd.txt
echo $3 >> /etc/vsftpd.txt
db_load -T -t hash -f /etc/vsftpd.txt /etc/vsftpd_login.db
echo “local_root=/srv/http/$1” > /etc/vsftpd_user_conf/$1

# restart all
/etc/rc.d/nginx restart
/etc/rc.d/vsftpd restart

分类: L.A.M.P 标签: , ,
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.