[root@lys conf]# cd /var/www/html/
[root@lys html]# mkdir google tfft
[root@lys html]# vim google/index.html
[root@lys html]# vim tfft/index.html
[root@lys html]# cat google/index.html
<h1> welcome to google ! </h1>
[root@lys html]# cat tfft/index.html
<h1> welcome to tfft ! </h1>
[root@lys html]# vim /etc/httpd/conf.d/vhosts.conf
[root@lys html]# cat /etc/httpd/conf.d/vhosts.conf
NameVirtualHost 192.168.102.123
<VirtualHost 192.168.102.123>
DocumentRoot /var/www/html/google
ServerName www.google.com
</VirtualHost>php
<VirtualHost 192.168.102.123>
DocumentRoot /var/www/html/tfft
ServerName www.tfft.com
</VirtualHost>
[root@lys html]# /etc/init.d/httpd restart
中止 httpd: [肯定]
正在啓動 httpd:httpd: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName
[肯定]html
補充:Windows系統中C:\Windows\System32\drivers\etc\hosts可添加IP和域名對應關係mysql
192.168.102.123 www.google.com
192.168.102.123 www.tfft.comweb
1.安裝相應軟件包sql
[root@lys html]# rpm -qa httpd mysql-server mysql php php-mysql
httpd-2.2.15-59.el6.centos.x86_64
[root@lys html]# yum install mysql-server mysql php php-mysql數據庫
2.配置mysqlapache
[root@lys html]# /etc/init.d/mysqld restart
中止 mysqld: [肯定]
初始化 MySQL 數據庫: Installing MySQL system tables...vim
[root@lys html]# chkconfig mysqld on
[root@lys html]# chkconfig mysqld --list
mysqld 0:關閉 1:關閉 2:啓用 3:啓用 4:啓用 5:啓用 6:關閉centos
[root@lys html]# mysqladmin -u root password 'Taren1'dom
3.配置PHP
[root@lys html]# vim /etc/php.ini
.. ..
default_charset = "utf-8" //設置默認字符集
file_uploads = On //容許從PHP網頁上傳文件
upload_max_filesize = 2M //容許上傳的文件大小
post_max_size = 8M //每次POST提交的數據限制
4.配置httpd
[root@lys html]# vim /etc/httpd/conf/httpd.conf
...
DirectoryIndex index.php index.html
[root@lys html]# vim /var/www/html/test1.php
<?php
phpinfo();
?>
[root@lys html]# vim /var/www/html/test2.php
<?php
$link=mysql_connect('localhost','root','Taren1');
if($link) echo "Success !!"; //成功則顯示Success !!
else echo "Failure !!"; //失敗則顯示Failure !!
mysql_close(); //關閉數據庫鏈接
?>
5.重啓httpd服務及訪問
[root@lys html]# /etc/init.d/httpd restart
中止 httpd: [肯定]
正在啓動 httpd:httpd: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName
[肯定]
1.建論壇庫
[root@lys ~]# mysql -uroot -p
Enter password: //驗證管理密碼
mysql> create database bbsdb; //建立bbsdb數據庫
mysql> show databases; //查看數據庫
mysql> grant all on bbsdb.* to runbbs@localhost identified by 'pwd123'; //受權數據庫
mysql> quit
2.部署論壇網頁代碼
[root@lys ~]# unzip Discuz_X3.2_SC_UTF8.zip -d tdir
[root@lys ~]# ls -F tdir/
[root@lys ~]# cp -rf tdir/upload/ /var/www/html/bbs
[root@lys ~]# cd /var/www/html/bbs/
[root@lys bbs]# chown -R apache template/ config/ data/ uc_client/ uc_server/
3.安裝論壇系統及後續訪問
http://192.168.102.123/bbs/install/