学习笔记:LAMP配置备忘
时间:2009-07-15 来源:bloodmanminmin
APACHE
安装
依赖关系太多依赖关系太多,用yum装
yum install httpd -y
依赖的程序
apr,apr-util,postgresql-libs
配置文件: /etc/httpd/conf/httpd.conf
启动service httpd start,第一次启动有个警告,意思就是没有服务名。
将ServerName 一行的注释去掉,修改为ServerName www.test.com:80
DocumentRoot "/var/www/html" #默认的网站根目录
DirectoryIndex index.html index.html.var index.php #默认支持的首页格式类型
ServerRoot "/etc/httpd" #配置文件目录
开启个人用户网站
vim httpd.conf
注释UserDir disable #默认禁用
UserDir public_html #开启
mkdir /home/redhat/public_html
echo "This is redhat's page!" > /home/redhat/public_html/index.html(默认的首页没有htm,我有次弄成index.htm,弄死出不来,注意啊!)
chmod 701 /home/redhat/ #可进入public_html目录,不然不能访问
http://192.168.0.1/~redhat(
取消~号:
ln -s /home/redhat/public_html /var/www/html/redhat
默认网站的设置
<Directory "/var/www/html">
Options Indexes FollowSymLinks #Indexes参数危险,如果找不到首页,返回整个网站的目录结构,作用网站有链接指向另外的地方
AllowOverride None #没有做认证
Order allow,deny #认证顺序,先允许,后拒绝
Allow from all #如果没有允许就默认全部拒绝(例allow .test.com;allow 192.168.0.) </Directory> 网站加认证: <Directory "/home/redhat/public_html"> #启用认证 AllowOverride authconfig </Directory> vim /home/redhat/public_html/.htaccess #在httpd.conf里面定义了文件名称 AccessFileName .htaccess authname "hello" authtype basic authuserfile /etc/httpd/wwwpasswd #自建认证文件,自己命名 require valid-user htpasswd -c /etc/httpd/wwwpasswd redhat #第一次创建加-c,把redhat用户加到认证文件里 htpasswd wwwpasswd tom #第二次加用户不用-c 虚拟主机 NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /home/redhat/public_html
ServerName www.redhat.com
ErrorLog logs/redhat-error_log
CustomLog logs/redhat-access_log common
</VirtualHost> <VirtualHost *:80>
…… …… </VirtualHost> LAMP(linux+apache+mysql+php) 安装mysql (rpm包安装:perl-dbi,mysql,perl-dbd-mysql,mysql-server,mysql-devel) yum install mysql -y yum install mysql-server -y 安装php (rpm包安装:php,php-common,php-pdo,php-cli,php-mysql) yum install php php-mysql -y 配置/etc/httpd/conf/httpd.conf AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php #这2行新增
AddType application/x-httpd-php-source .phps # …… AddHandler cgi-script .cgi .pl #前面注释取消 完成后service mysql start 1、mysqladmin -u root password 123 2、mysql -u root -p
mysql>show databases; mysql>create database dvbbs; #论坛用的数据库 安装dvbbs(动网bbs) 解压unzip dvbbs.zip 解压完成后将upload里的文件拷贝到/var/www/html/dvbbs里面 chmod -R 777 /var/www/html/dvbbs 浏览器中输入http://192.168.0.1/dvbbs/install.pl,按提示做就行了 如果显示乱码,可以讲httpd.conf中AddDefaultCharset UTF-8注释掉,apache会自动判断
Allow from all #如果没有允许就默认全部拒绝(例allow .test.com;allow 192.168.0.) </Directory> 网站加认证: <Directory "/home/redhat/public_html"> #启用认证 AllowOverride authconfig </Directory> vim /home/redhat/public_html/.htaccess #在httpd.conf里面定义了文件名称 AccessFileName .htaccess authname "hello" authtype basic authuserfile /etc/httpd/wwwpasswd #自建认证文件,自己命名 require valid-user htpasswd -c /etc/httpd/wwwpasswd redhat #第一次创建加-c,把redhat用户加到认证文件里 htpasswd wwwpasswd tom #第二次加用户不用-c 虚拟主机 NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /home/redhat/public_html
ServerName www.redhat.com
ErrorLog logs/redhat-error_log
CustomLog logs/redhat-access_log common
</VirtualHost> <VirtualHost *:80>
…… …… </VirtualHost> LAMP(linux+apache+mysql+php) 安装mysql (rpm包安装:perl-dbi,mysql,perl-dbd-mysql,mysql-server,mysql-devel) yum install mysql -y yum install mysql-server -y 安装php (rpm包安装:php,php-common,php-pdo,php-cli,php-mysql) yum install php php-mysql -y 配置/etc/httpd/conf/httpd.conf AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php #这2行新增
AddType application/x-httpd-php-source .phps # …… AddHandler cgi-script .cgi .pl #前面注释取消 完成后service mysql start 1、mysqladmin -u root password 123 2、mysql -u root -p
mysql>show databases; mysql>create database dvbbs; #论坛用的数据库 安装dvbbs(动网bbs) 解压unzip dvbbs.zip 解压完成后将upload里的文件拷贝到/var/www/html/dvbbs里面 chmod -R 777 /var/www/html/dvbbs 浏览器中输入http://192.168.0.1/dvbbs/install.pl,按提示做就行了 如果显示乱码,可以讲httpd.conf中AddDefaultCharset UTF-8注释掉,apache会自动判断
相关阅读 更多 +
排行榜 更多 +