Apache
简单配置(5)搭建phpcms2007网站+phpBB-3.0论坛
RHEL5.3
基本网络配置
1、
1
、RHEL5 U3:如图1
(如图1)
2
、#hostname //查看当前主机的主机名:如图2
(如图2)
3
、#vi /etc/sysconfig/network-scripts/ifcfg-eth0 编辑指定网络接口配置文件:如图3
(如图3)
4
、#vi /etc/sysconfig/network 经过配置文件修改主机名:如图4
(如图4)
5
、在终端字符界面修改其字体和中文字体大小:如图5
(如图5)
6
、挂载光盘:如图6
(如图6)
7
、查看OpenSSH是否安装:如图7
(如图7)
8
、
#vi /etc/hosts
设置本地
DNS
解析文件:
如图8
(如图8)
9
、
#vi /etc/resolv.conf
指定当前主机的
DNS
服务器,最多可指定三个:
如图9
(如图9)
10
、关闭iptables防火墙:如图10
(如图10)
2、DNS简单配置
一、vim /etc/named.conf
二、vim /var/named/benet.com.zone
三、vim /var/named/1.168.192.in-addr.arpa.zone
3、nslookup查看
4、Apache简单配置
[root@dns ~]# cd /mnt/dvd/
[root@dns dvd]# ls
httpd-2.2.11.tar.gz php-5.2.11.tar.gz phpcms2007_sp4_gbk
mysql-5.1.39-linux-i686-glibc23.tar.gz phpBB-3.0.RC5 phpcms2007_sp4_utf8
[root@dns dvd]#
tar zxvf httpd-2.2.11.tar.gz
[root@dns dvd]# cd httpd-2.2.11
[root@dns httpd-2.2.11]#
./configure --prefix=/usr/local/apache --enable-modules=so
[root@dns httpd-2.2.11]#
make
[root@dns httpd-2.2.11]#
make install
[root@dns httpd-2.2.11]#
/usr/local/apache/bin/apachectl start
[root@dns httpd-2.2.11]#
netstat -ntl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:690 0.0.0.0:* LISTEN
tcp 0 0 192.168.1.200:53 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:2207 0.0.0.0:* LISTEN
tcp 0 0 :::80 :::* LISTEN
tcp 0 0 :::22 :::* LISTEN
tcp 0 0 ::1:953 :::* LISTEN
[root@dns httpd-2.2.11]#
测试:
5、Mysql简单配置
[root@dns ~]# cd /mnt/dvd/
[root@dns dvd]#
tar zxvf mysql-5.1.39-linux-i686-glibc23.tar.gz
[root@dns dvd]#
[root@dns dvd]#
mv mysql-5.1.39-linux-i686-glibc23 /usr/local/
[root@dns dvd]#
cd /usr/local/
[root@dns local]#
ln -s mysql-5.1.39-linux-i686-glibc23 mysql
[root@dns local]#
groupadd mysql
[root@dns local]#
useradd -g mysql mysql
[root@dns local]#
/usr/local/mysql/scripts/mysql_install_db
(注意会出错,在/usr/local/mysql/路径下安装)
FATAL ERROR: Could not find ./bin/my_print_defaults
If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.
If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.
[root@dns local]#
cd /usr/local/mysql/
[root@dns mysql]#
./scripts/mysql_install_db
Installing MySQL system tables...
091008 17:35:55 [Warning] Forcing shutdown of 2 plugins
OK
Filling help tables...
091008 17:35:56 [Warning] Forcing shutdown of 2 plugins
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h dns password 'new-password'
Alternatively you can run:
./bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl
Please report any problems with the ./bin/mysqlbug script!
The latest information about MySQL is available at http://www.mysql.com/
Support MySQL by buying support/licenses from http://shop.mysql.com/
[root@dns mysql]#
chown -R root /usr/local/mysql/
[root@dns mysql]#
chown -R mysql /usr/local/mysql/data/
[root@dns mysql]#
chown -R mysql /usr/local/mysql/
[root@dns mysql]#
/usr/local/mysql/bin/mysqld_safe -user=mysql &
[1] 20120
[root@dns mysql]# 091008 17:48:42 mysqld_safe Logging to '/usr/local/mysql/data/dns.err'.
091008 17:48:42 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
[root@dns mysql]#
/usr/local/mysql/bin/mysqladmin -u root password wishes
[root@dns mysql]#
/usr/local/mysql/bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.39 MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> exit
Bye
[root@dns mysql]#
netstat -ntl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:690 0.0.0.0:* LISTEN
tcp 0 0 192.168.1.200:53 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:2207 0.0.0.0:* LISTEN
tcp 0 0 :::80 :::* LISTEN
tcp 0 0 :::22 :::* LISTEN
tcp 0 0 ::1:953 :::* LISTEN
6、PHP简单配置
[root@dns mysql]# cd
[root@dns ~]# cd /mnt/dvd/
[root@dns dvd]#
tar zxvf php-5.2.11.tar.gz
[root@dns dvd]#
cd php-5.2.11
[root@dnsphp-5.2.11]#
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql
[root@dns php-5.2.11]#
make
[root@dns php-5.2.11]#
make install
[root@dns php-5.2.11]#
cp php.ini-dist /usr/local/lib/php.ini
[root@dns php-5.2.11]#
vim /usr/local/apache/conf/httpd.conf
1. 确认PHP模块已经添加?
LoadModule php5_module modules/libphp5.so
在53行,若是咱们在安装php时,在参数中跟加了apxs,那么apache的配置文件中已经存在了此项,如没添加则手工添加
二、修改98行
三、修改167行
四、让apache识别*.php文件 310行
在apache 配置文件中添加
AddType application/x-httpd-php .php
五、测试apache和php是否整合成功
[root@dns php-5.2.11]#
cd /usr/local/apache/htdocs/
You have new mail in /var/spool/mail/root
[root@dns htdocs]#
vim index.php
<?php
phpinfo();
?>
~
~
"index.php" [新] 3L, 20C 已写入
[root@dns htdocs]#
/usr/local/apache/bin/apachectl stop
(注意会出错,修改SELinux)
httpd: Syntax error on line 53 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/modules/libphp5.so into
server: /usr/local/apache/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied
[root@dns htdocs]#
[root@dns htdocs]#
vim /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=
disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
~
~
"/etc/selinux/config" 10L, 447C 已写入
[root@dns htdocs]#
reboot
7、
phpBB-3.0
论坛
一、新建bbs目录,并设置权限
[root@dns ~]# cd /usr/local/apache/htdocs/
[root@dns htdocs]# ls
index.html
[root@dns htdocs]# ll
总计 8
-rw-r--r-- 1 root root 44 2004-11-21 index.html
[root@dns htdocs]# cd
[root@dns ~]#
mkdir /usr/local/apache/htdocs/bbs/
[root@dns ~]# cd /usr/local/apache/htdocs/
[root@dns htdocs]# ls
bbs index.html
[root@dns htdocs]# cd
[root@dns ~]#
chmod -R 777 /usr/local/apache/htdocs/bbs/
二、复制
phpBB-3.0
论坛文件到/usr/local/apache/htdocs/bbs/目录下
[root@dns ~]# cd /mnt/dvd/
[root@dns dvd]# ls
httpd-2.2.11 php-5.2.11 phpcms2007_sp4_gbk
httpd-2.2.11.tar.gz php-5.2.11.tar.gz phpcms2007_sp4_utf8
mysql-5.1.39-linux-i686-glibc23.tar.gz phpBB-3.0.RC5
[root@dns dvd]# cd phpBB-3.0.RC5/
[root@dns phpBB-3.0.RC5]# ls
lang_zh_cmn_hans.zip phpBB-3.0.RC5.zip subsilver2_zh_cmn_hans.zip
phpBB3 prosilver_zh_cmn_hans.zip
[root@dns phpBB-3.0.RC5]# cd phpBB3
[root@dns phpBB3]# ls
adm download.php install search.php viewonline.php
cache faq.php language store viewtopic.php
common.php files mcp.php style.php
config.php p_w_picpaths memberlist.php styles
cron.php includes posting.php ucp.php
docs index.php report.php viewforum.php
[root@dns phpBB3]# cd
[root@dns ~]# cp -r /mnt/dvd/phpBB-3.0.RC5/phpBB
phpBB3/ phpBB-3.0.RC5.zip
[root@dns ~]#
cp -r /mnt/dvd/phpBB-3.0.RC5/phpBB3/* /usr/local/apache/htdocs/bbs/
[root@dns ~]# cd /usr/local/apache/htdocs/
[root@dns htdocs]# ls
bbs index.html
[root@dns htdocs]# cd bbs
[root@dns bbs]# ls
adm download.php install search.php viewonline.php
cache faq.php language store viewtopic.php
common.php files mcp.php style.php
config.php p_w_picpaths memberlist.php styles
cron.php includes posting.php ucp.php
docs index.php report.php viewforum.php
三、chmod 777修改/usr/local/apache/htdocs/bbs/目录下
[root@dns bbs]#
chmod 777 ./cache/
[root@dns bbs]#
chmod 777 ./files/
[root@dns bbs]#
chmod 777 ./store/
[root@dns bbs]#
chmod 777 ./config.php
[root@dns bbs]#
chmod 777 ./p_w_picpaths/avatars/upload/
[root@dns bbs]#
四、建立phpbb数据库
[root@dns ~]# /usr/local/mysql/bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 5.1.39 MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database phpbb;
Query OK, 1 row affected (0.02 sec)
mysql> quit
Bye
输入:http://bbs.benet.com/bbs/
8、
phpcms2007
网站
一、设置权限chmod –R 777 /usr/local/apache/htdocs/
[root@dns htdocs]#
chmod -R 777 /usr/local/apache/htdocs/
二、复制phpcms2007网站文件到/usr/local/apache/htdocs/下
[root@dns ~]#
cp -r /mnt/dvd/phpcms2007_sp4_utf8/phpcms/* /usr/local/apache/htdocs/
cp:是否覆盖“/usr/local/apache/htdocs/index.html”? y
[root@dns ~]# cd /usr/local/apache/htdocs/
[root@dns htdocs]# ls
admin cert formguide js.php page toimg.php
admin.php checkcode.php guestbook languages pay union
ads comment p_w_picpaths link picture uploadfile
announce config.inc.php include mail product upload.php
area.php data index.html member segment_word.php vote
article down index.php message sitemap.xml
ask editor info module spider
bbs favicon.ico install movie stat
bill fckeditor install.php mypage templates
配置文件在附件里面:
若有不懂的地方,请call我!qq:357714938 mail:hongwish8es@126.com