DIYism schooner能逆风行驶的纵帆船是生命的极好象征,贝努利效应正是化逆为顺的经典!--呆仁 收藏本站 涂鸦本站 来信本站 跟我MSN 跟我QQ GTalk 思想农业天文生物文化饮食娱乐硬件健康语言心理网络物理政治个人编程软件工具 php学习笔记
javascript学习笔记
flash学习笔记
css学习笔记
xsl学习笔记
sql学习笔记
ubuntu安装配置
centos安装配置
damnsmall安装配置
python学习笔记
呓语录
(np2p)
=========================================安装apache=========================================
cd /usr/local/apache2
wget http://<apache官方地址>/httpd-2.0.59.tar.gz
tar zxvf httpd-2.0.59.tar.gz
cd httpd-2.0.59
./configure --prefix=/usr/local/apache2
#有时需要先chmod -R 777 configure给configure文件赋权
make
make install
cd ..
rm httpd-2.0.59.tar.gz
cp bin/httpd /etc/rc.d/init.d/httpd
启动apache:
/etc/rc.d/init.d/httpd -k start
=========================================配置apache=========================================
vi /usr/local/apache2/conf/httpd.conf
DirectoryIndex改为index.php index.htm index.html
改DocumentRoot "/usr/local/apache2/htdocs"为DocumentRoot "/var/www/html"
改<Directory "/usr/local/apache2/htdocs">为<Directory "/var/www/html">
在<Directory "/var/www/html">内加入Options -Indexes以不显示目录索引
添加LoadModule php5_module modules/libphp5.so
加上AddType application/x-httpd-php .php
添加虚拟机:
NameVirtualHost *:80
<VirtualHost *:80>
 ServerName labs.liba.com
 DocumentRoot /var/www/html/labs
 Alias /search /var/www/html/search/
 #有时需要设"路径别名"(类似于IIS里的"虚拟目录"),注意别名末尾没有"/"而真名末尾有"/",表示"文件别名"和"路径别名"都指向"路径真名"
 php_admin_value open_basedir /var/www/html/labs:/tmp
</VirtualHost>
<VirtualHost *:80>
 ServerName myliba.liba.com
 DocumentRoot /var/www/html/myliba
 php_admin_value open_basedir /var/www/html/myliba:/tmp
</VirtualHost>
<VirtualHost *:80>
 ServerName search.liba.com
 DocumentRoot /var/www/html/search
 php_admin_value open_basedir /var/www/html/search:/tmp
</VirtualHost>

=========================================安装mysql=========================================
cd /usr/local/mysql
wget http://download.freelamp.com/LAMP/mysql-5.0.27.tar.gz #下载mysql(不从mysql官方下载,因上面只有最新不稳定版的源码)
tar zxvf mysql-5.0.27.tar.gz
cd mysql-5.0.27
./configure -prefix=/usr/local/mysql -with-charset=utf8 -with-extra-charsets=all #这样就使character_set_database为utf8了
make               #mysql编译时间非常长
make install
cp support-files/my-medium.cnf /etc/my.cnf
cp support-files/mysql.server /etc/rc.d/init.d/mysql.server
cd ..
rm mysql-5.0.27.tar.gz
groupadd mysql
useradd -g mysql mysql
chown -R root /usr/local/mysql
chgrp -R mysql /usr/local/mysql
chown -R mysql /usr/local/mysql/var
/usr/local/mysql/bin/mysql_install_db --user=mysql &
/usr/local/mysql/bin/mysqld_safe --user=mysql #启动mysql
/usr/local/mysql/bin/mysqladmin -uroot password xxxxx //为root访问设置密码
/etc/rc.d/init.d/mysql.server stop #停止mysql,有时需要ps -e | grep mysqld查看id, 再kill该id
vi /etc/rc.local
添加/usr/local/mysql/bin/safe_mysqld --user=mysql & #让mysql随系统启动
/usr/local/mysql/bin/mysql -u root -p密码
show databases;
如果有多余的数据库, 用drop database database_name;
安装web程序时需要新建数据库:
create database db_app;    #分号不能掉了
grant all on db_app1.*,db_app2.* to db_user@localhost identified by '密码'; #同时就是在创建用户,这是创建/修改用户的简便方法
新增数据库时可以用root用户身份直接执行下面语句来给db_user赋权:
INSERT INTO `db` (`Host`, `Db`, `User`, `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Create_priv`, `Drop_priv`, `Grant_priv`, `References_priv`, `Index_priv`, `Alter_priv`, `Create_tmp_table_priv`, `Lock_tables_priv`, `Create_view_priv`, `Show_view_priv`, `Create_routine_priv`, `Alter_routine_priv`, `Execute_priv`) VALUES
('localhost', 'db_app1', 'db_user', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y');
两种方法都要重启mysql服务

=========================================配置mysql=========================================
/etc/my.cnf的[mysqld]下加上default-character-set=utf8 #控制系统变量character_set_system和character_set_server

=========================================安装php=========================================
cd /usr/local/php
wget http://<php官方地址>/php-5.1.6.tar.gz
tar zxvf php-5.1.6.tar.gz
cd php-5.1.6
./configure --prefix=/usr/local/php \
--with-apxs2=/usr/local/apache2/bin/apxs \     #生成libphp5.so文件
--enable-sockets \
--with-config-file-path=/usr/local/php \设置配置文件路径
--with-mysql=/usr/local/mysql \ #添加mysql扩展
--enable-so #不能去掉, 否则启动apache报undefined symbol: php_escape_html_entities
make      #php编译较耗时
make install
cp php.ini-dist /usr/local/php/php.ini
cd ..
rm php-5.1.6.tar.gz
添加扩展:
cd /usr/local/php/php-5.1.6/ext/mbstring
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
cp modules/mbstring.so /usr/local/php/ext/mbstring.so
(安装gd库:
先分别安装jpeg,zlib,libpng,
再cd /usr/local/php/php-5.1.6/ext/gd
./configure --with-php-config=/usr/local/php/bin/php-config \
--with-jpeg-dir=/usr/local/php/php-5.1.6/ext/jpeg-6b \
--with-zlib-dir=/usr/local/php/php-5.1.6/ext/zlib \
--with-png-dir=/usr/local/php/php-5.1.6/ext/libpng-1.2.16
...
)
将php.ini里
extension_dir = "./"改成extension_dir = /usr/local/php/ext
extension=php_mbstring.dll去掉注释改成extension=mbstring.so
/etc/rc.d/init.d/httpd -k restart

=========================================配置php.ini=========================================
vi /usr/local/php/php.ini
open_basedir = /var/www/html #限制php的访问文件范围
error_reporting = 0 #以防报错时泄漏代码
register_globals = Off #避免post/get/cookie覆盖变量的漏洞

=========================================配置rsync=========================================
service xinetd start
建/etc/rsyncd.conf:
[search]
path = /var/www/html/_test/search
auth users = search
uid = root
gid = root
secrets file = /etc/rsyncd.secrets
read only = no
建/etc/rsyncd.secrets:
search:111111
并chmod 600 /etc/rsyncd.secrets
启动:
rsync --daemon
开放端口873:
iptables -A RH-Firewall-1-INPUT -p tcp -m state --state NEW --dport 873 -j ACCEPT
service iptables save #即:/etc/rc.d/init.d/iptables save
service iptables restart
=========================================杂项=========================================
查看开放端口:
netstat -anp
iptables -L
重启网络;
service network restart

  您的网址:(可能:)呆元:2385年11月11日(17-12-15)访客总人次:433220(自k5a1)  
Copyleft 2364-2378 DIYism
Powered by Ubuntu Server & ZPC-GX
全民备TOR 安全上网