Apache簡單配置(5)搭建phpcms2007網站+phpBB-3.0論壇
阿新 • • 發佈:2020-10-15
Apache簡單配置(5)搭建phpcms2007網站+phpBB-3.0論壇
RHEL5.3 基本網路配置
一、
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)
二、DNS簡單配置
1、vim /etc/named.conf
2、vim /var/named/benet.com.zone
3、vim /var/named/1.168.192.in-addr.arpa.zone
三、nslookup檢視
四、Apache簡單配置
[[email protected] ~]# cd /mnt/dvd/
[[email protected] 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
[[email protected] dvd]# tar zxvf httpd-2.2.11.tar.gz
[[email protected] dvd]# cd httpd-2.2.11
[[email protected] httpd-2.2.11]# ./configure --prefix=/usr/local/apache --enable-modules=so
[[email protected] httpd-2.2.11]# make
[[email protected] httpd-2.2.11]# make install
[[email protected] httpd-2.2.11]# /usr/local/apache/bin/apachectl start
[[email protected] 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
[[email protected] httpd-2.2.11]#
測試:
五、Mysql簡單配置
[[email protected] ~]# cd /mnt/dvd/
[[email protected] dvd]# tar zxvf mysql-5.1.39-linux-i686-glibc23.tar.gz
[[email protected] dvd]#
[[email protected] dvd]# mv mysql-5.1.39-linux-i686-glibc23 /usr/local/
[[email protected] dvd]# cd /usr/local/
[[email protected] local]# ln -s mysql-5.1.39-linux-i686-glibc23 mysql
[[email protected] local]# groupadd mysql
[[email protected] local]# useradd -g mysql mysql
[[email protected] 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.
[[email protected] local]# cd /usr/local/mysql/
[[email protected] 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/
[[email protected] mysql]# chown -R root /usr/local/mysql/
[[email protected] mysql]# chown -R mysql /usr/local/mysql/data/
[[email protected] mysql]# chown -R mysql /usr/local/mysql/
[[email protected] mysql]# /usr/local/mysql/bin/mysqld_safe -user=mysql &
[1] 20120
[[email protected] 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
[[email protected] mysql]# /usr/local/mysql/bin/mysqladmin -u root password wishes
[[email protected] 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
[[email protected] 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
六、PHP簡單配置
[[email protected] mysql]# cd
[[email protected] ~]# cd /mnt/dvd/
[[email protected] dvd]# tar zxvf php-5.2.11.tar.gz
[[email protected] dvd]# cd php-5.2.11
[[email protected]]#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql
[[email protected] php-5.2.11]# make
[[email protected] php-5.2.11]# make install
[[email protected] php-5.2.11]# cp php.ini-dist /usr/local/lib/php.ini
[[email protected] php-5.2.11]# vim /usr/local/apache/conf/httpd.conf
1. 確認PHP模組已經新增?
LoadModule php5_module modules/libphp5.so
在53行,如果我們在安裝php時,在引數中跟加了apxs,那麼apache的配置檔案中已經存在了此項,如沒新增則手工新增
2、修改98行
3、修改167行
4、讓apache識別*.php檔案 310行
在apache 配置檔案中新增AddType application/x-httpd-php .php
5、測試apache和php是否整合成功
[[email protected] php-5.2.11]# cd /usr/local/apache/htdocs/
You have new mail in /var/spool/mail/root
[[email protected] htdocs]# vim index.php
<?php
phpinfo();
?>
~
~
"index.php" [新] 3L, 20C 已寫入
[[email protected] 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
[[email protected] htdocs]#
[[email protected] 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 已寫入
[[email protected] htdocs]# reboot
訪問,在瀏覽器中輸入http://192.168.1.200/index.php 出現一下介面則說明整合成功
七、phpBB-3.0論壇
1、新建bbs目錄,並設定許可權
[[email protected] ~]# cd /usr/local/apache/htdocs/
[[email protected] htdocs]# ls
index.html
[[email protected] htdocs]# ll
總計 8
-rw-r--r-- 1 root root 44 2004-11-21 index.html
[[email protected] htdocs]# cd
[[email protected] ~]# mkdir /usr/local/apache/htdocs/bbs/
[[email protected] ~]# cd /usr/local/apache/htdocs/
[[email protected] htdocs]# ls
bbs index.html
[[email protected] htdocs]# cd
[[email protected] ~]# chmod -R 777 /usr/local/apache/htdocs/bbs/
2、複製phpBB-3.0論壇檔案到/usr/local/apache/htdocs/bbs/目錄下
[[email protected] ~]# cd /mnt/dvd/
[[email protected] 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
[[email protected] dvd]# cd phpBB-3.0.RC5/
[[email protected] 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
[[email protected] phpBB-3.0.RC5]# cd phpBB3
[[email protected] 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
[[email protected] phpBB3]# cd
[[email protected] ~]# cp -r /mnt/dvd/phpBB-3.0.RC5/phpBB
phpBB3/ phpBB-3.0.RC5.zip
[[email protected] ~]# cp -r /mnt/dvd/phpBB-3.0.RC5/phpBB3/* /usr/local/apache/htdocs/bbs/
[[email protected] ~]# cd /usr/local/apache/htdocs/
[[email protected] htdocs]# ls
bbs index.html
[[email protected] htdocs]# cd bbs
[[email protected] 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
3、chmod 777修改/usr/local/apache/htdocs/bbs/目錄下
[[email protected] bbs]#chmod 777 ./cache/
[[email protected] bbs]# chmod 777 ./files/
[[email protected] bbs]# chmod 777 ./store/
[[email protected] bbs]# chmod 777 ./config.php
[[email protected] bbs]# chmod 777 ./p_w_picpaths/avatars/upload/
[[email protected] bbs]#
4、建立phpbb資料庫
[[email protected] ~]# /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
5、IE測試http://192.168.1.200/bbs/install/index.php
安裝完成後輸入:http://bbs.benet.com/bbs進行瀏覽
輸入:http://bbs.benet.com/bbs/
八、phpcms2007網站
1、設定許可權chmod –R 777 /usr/local/apache/htdocs/
[[email protected] htdocs]#chmod -R 777 /usr/local/apache/htdocs/
2、複製phpcms2007網站檔案到/usr/local/apache/htdocs/下
[[email protected] ~]# cp -r /mnt/dvd/phpcms2007_sp4_utf8/phpcms/* /usr/local/apache/htdocs/
cp:是否覆蓋“/usr/local/apache/htdocs/index.html”? y
[[email protected] ~]# cd /usr/local/apache/htdocs/
[[email protected] 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
3、IE測試:http://192.168.1.200
安裝完成後輸入:http://www.benet.com進行瀏覽
配置檔案在附件裡面:
如有不懂的地方,請call我!qq:357714938 mail:[email protected]