Apache简单配置(2)

Apache 简单配置(2)
案例:
企业需求
公司要为自己网站搭建一个论坛来实现广大用户的在线交流,内网采用的IP地址为192.168.1.200,要求服务器满足1000人同时在线访问,并且服务器上有个非常重要的目录/security,里面的内容仅允许来自tech.benet.com这个域的成员访问,其他全部拒绝。管理员邮箱设置[email protected],首页设置index.php。Apache根目录和文档保持默认设置/var/www/html/bbs
需求分析
搭建动态网站我们首先要把相关的软件包安装好哈~LAMP是一个比较好的选择。对于特殊的要求我们可以在主配置文件中通过相应字段进行设置:ServerAdmin字段可以设置管理员邮箱地址,DirectoryIndex字段可以设置首页文件,MaxClients字段可以设置客户端连接数等等
RHEL5.3 基本网络配置
一、
1 、RHEL5 U3:如图1
clip_image002
(如图1)
2 、#hostname //查看当前主机的主机名:如图2
clip_image003
(如图2)
3 、#vi /etc/sysconfig/network-scripts/ifcfg-eth0 编辑指定网络接口配置文件:如图3
clip_image005
(如图3)
4 、#vi /etc/sysconfig/network 通过配置文件修改主机名:如图4
clip_image007
(如图4)
5 、在终端字符界面修改其字体和中文字体大小:如图5
clip_image009
(如图5)
6 、挂载光盘:如图6
clip_image011
(如图6)
7 、查看OpenSSH是否安装:如图7
clip_image013
(如图7)
8 #vi /etc/hosts 设置本地 DNS 解析文件: 如图8
etc-hosts
(如图8)
9 #vi /etc/resolv.conf 指定当前主机的 DNS 服务器,最多可指定三个: 如图9
etc-resolv
(如图9)
10 、关闭iptables防火墙:如图10
clip_image018
clip_image020
clip_image022
clip_image024
(如图10)
二、DNS简单配置
1、vim /etc/named.conf
clip_image026
2、vim /var/named/benet.com.zone
clip_image028
3、vim /var/named/1.168.192.in-addr.arpa.zone
clip_image030
三、nslookup查看
clip_image031
四、Apache简单配置
1、HTTPD安装
httpd-2.2.3-11.el5.i386.rpm
httpd-devel-2.2.3-11.el5.i386.rpm
httpd-manual-2.2.3-11.el5.i386.rpm
system-config-httpd-1.3.3.1-1.el5.noarch.rpm
[root@dns Server]# ls -l | grep httpd
-r--r--r-- 55 root root 1270589 2008-12-11 httpd-2.2.3-22.el5.i386.rpm
-r--r--r-- 63 root root 151651 2008-12-11 httpd-devel-2.2.3-22.el5.i386.rpm
-r--r--r-- 55 root root 852783 2008-12-11 httpd-manual-2.2.3-22.el5.i386.rpm
-r--r--r-- 148 root root 611542 2007-11-27 system-config-httpd-1.3.3.3-1.el5.noarch.rpm
[root@dns Server]# rpm -ivh --aid httpd-2.2.3-22.el5.i386.rpm
warning: httpd-2.2.3-22.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:httpd ########################################### [100%]
[root@dns Server]# rpm -ivh --aid httpd-devel-2.2.3-22.el5.i386.rpm
warning: httpd-devel-2.2.3-22.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
apr-devel is needed by httpd-devel-2.2.3-22.el5.i386
apr-util-devel is needed by httpd-devel-2.2.3-22.el5.i386
[root@dns Server]# rpm -ivh --aid apr-devel-1.2.7-11.i386.rpm
warning: apr-devel-1.2.7-11.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:apr-devel ########################################### [100%]
[root@dns Server]# rpm -ivh --aid apr-util-devel-1.2.7-7.el5.i386.rpm
warning: apr-util-devel-1.2.7-7.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:apr-util-devel ########################################### [100%]
[root@dns Server]# rpm -ivh --aid httpd-devel-2.2.3-22.el5.i386.rpm
warning: httpd-devel-2.2.3-22.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:httpd-devel ########################################### [100%]
[root@dns Server]# rpm -ivh --aid httpd-manual-2.2.3-22.el5.i386.rpm
warning: httpd-manual-2.2.3-22.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:httpd-manual ########################################### [100%]
[root@dns Server]# rpm -ivh --aid system-config-httpd-1.3.3.3-1.el5.noarch.rpm
warning: system-config-httpd-1.3.3.3-1.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
libxslt-python is needed by system-config-httpd-1.3.3.3-1.el5.noarch
[root@dns Server]# rpm -ivh --aid libxslt-python-1.1.17-2.el5_2.2.i386.rpm
warning: libxslt-python-1.1.17-2.el5_2.2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:libxslt-python ########################################### [100%]
[root@dns Server]# rpm -ivh --aid system-config-httpd-1.3.3.3-1.el5.noarch.rpm
warning: system-config-httpd-1.3.3.3-1.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:system-config-httpd ########################################### [100%]
clip_image033
clip_image035
2、MYSQL安装:
安装MySQL的时候,特别要注意安装顺序哈~否则MySQL无法正常安装成功,参考以下安装顺序就可以顺序完成安装
安装第一个软件包: perl-DBI-1.52-1.fc6.i386.rpm
安装第二个软件包: mysql-5.0.22-2.1.0.1.i386.rpm
安装第三个软件包: perl-DBD-MySQL-3.0007-1.fc6.i386.rpm
安装第四个软件包: mysql-server-5.0.22-2.1.0.1.i386.rpm
安装第五个软件包: mysql-devel-5.0.22-2.1.0.1.i386.rpm
[root@dns Server]# ls -l | grep mysql
-r--r--r-- 91 root root 16035 2008-10-14 freeradius-mysql-1.1.3-1.4.el5.i386.rpm
-r--r--r-- 99 root root 17668 2007-01-19 libdbi-dbd-mysql-0.8.1a-1.2.2.i386.rpm
-r--r--r-- 99 root root 22570 2007-01-19 mod_auth_mysql-3.0.0-3.1.i386.rpm
-r--r--r-- 117 root root 4347498 2008-04-02 mysql-5.0.45-7.el5.i386.rpm
-r--r--r-- 99 root root 525622 2008-04-02 mysql-bench-5.0.45-7.el5.i386.rpm
-r--r--r-- 99 root root 144863 2007-01-19 mysql-connector-odbc-3.51.12-2.2.i386.rpm
-r--r--r-- 113 root root 2508069 2008-04-02 mysql-devel-5.0.45-7.el5.i386.rpm
-r--r--r-- 99 root root 10143466 2008-04-02 mysql-server-5.0.45-7.el5.i386.rpm
-r--r--r-- 99 root root 3522524 2008-04-02 mysql-test-5.0.45-7.el5.i386.rpm
-r--r--r-- 69 root root 86519 2008-12-01 php-mysql-5.1.6-23.el5.i386.rpm
-r--r--r-- 99 root root 28166 2007-01-18 qt4-mysql-4.2.1-1.i386.rpm
-r--r--r-- 55 root root 11457 2008-12-02 rsyslog-mysql-2.0.6-1.el5.i386.rpm
[root@dns Server]# rpm -ivh --aid perl-DBI-1.52-2.el5.i386.rpm
warning: perl-DBI-1.52-2.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:perl-DBI ########################################### [100%]
[root@dns Server]# rpm -ivh --aid mysql-5.0.45-7.el5.i386.rpm
warning: mysql-5.0.45-7.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:mysql ########################################### [100%]
[root@dns Server]# rpm -ivh --aid perl-DBD-MySQL-3.0007-2.el5.i386.rpm
warning: perl-DBD-MySQL-3.0007-2.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:perl-DBD-MySQL ########################################### [100%]
[root@dns Server]# rpm -ivh --aid mysql-server-5.0.45-7.el5.i386.rpm
warning: mysql-server-5.0.45-7.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:mysql-server ########################################### [100%]
[root@dns Server]# rpm -ivh --aid mysql-devel-5.0.45-7.el5.i386.rpm
warning: mysql-devel-5.0.45-7.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:mysql-devel ########################################### [100%]
clip_image037
3、启动mysqld
[root@dns Server]# service mysqld restart
停止 MySQL: [失败]
初始化 MySQL 数据库: Installing MySQL system tables...
OK
Filling help tables...
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:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h dns password 'new-password'
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/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 /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
[确定]
启动 MySQL: [确定]
[root@dns Server]# mysqladmin -u root password wishes
[root@dns Server]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.45 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> exit
Bye
[root@dns Server]
clip_image039
4、安装PHP
安装 PHP 软件包
安装第一个软件包: php-common-5.1.6-15.el5.i386.rpm
安装第二个软件包: php-cli-5.1.6-15.el5.i386.rpm
安装第三个软件包: php-5.1.6-15.el5.i386.rpm
安装第四个软件包: php-pdo-5.1.6-15.el5.i386.rpm
安装第五个软件包: php-mysql-5.1.6-15.el5.i386.rpm
[root@dns Server]# ls -l | grep php
-r--r--r-- 69 root root 1210093 2008-12-01 php-5.1.6-23.el5.i386.rpm
-r--r--r-- 69 root root 33834 2008-12-01 php-bcmath-5.1.6-23.el5.i386.rpm
-r--r--r-- 69 root root 2217057 2008-12-01 php-cli-5.1.6-23.el5.i386.rpm
-r--r--r-- 69 root root 156876 2008-12-01 php-common-5.1.6-23.el5.i386.rpm
-r--r--r-- 69 root root 41051 2008-12-01 php-dba-5.1.6-23.el5.i386.rpm
-r--r--r-- 35 root root 524983 2008-12-01 php-devel-5.1.6-23.el5.i386.rpm
-r--r--r-- 69 root root 118420 2008-12-01 php-gd-5.1.6-23.el5.i386.rpm
-r--r--r-- 69 root root 54031 2008-12-01 php-imap-5.1.6-23.el5.i386.rpm
-r--r--r-- 69 root root 36215 2008-12-01 php-ldap-5.1.6-23.el5.i386.rpm
-r--r--r-- 69 root root 993525 2008-12-01 php-mbstring-5.1.6-23.el5.i386.rpm
-r--r--r-- 69 root root 86519 2008-12-01 php-mysql-5.1.6-23.el5.i386.rpm
-r--r--r-- 69 root root 40825 2008-12-01 php-ncurses-5.1.6-23.el5.i386.rpm
-r--r--r-- 69 root root 52937 2008-12-01 php-odbc-5.1.6-23.el5.i386.rpm
-r--r--r-- 69 root root 64933 2008-12-01 php-pdo-5.1.6-23.el5.i386.rpm
-r--r--r-- 148 root root 364195 2007-10-05 php-pear-1.4.9-4.el5.1.noarch.rpm
-r--r--r-- 69 root root 68137 2008-12-01 php-pgsql-5.1.6-23.el5.i386.rpm
-r--r--r-- 69 root root 29155 2008-12-01 php-snmp-5.1.6-23.el5.i386.rpm
-r--r--r-- 69 root root 139586 2008-12-01 php-soap-5.1.6-23.el5.i386.rpm
-r--r--r-- 69 root root 97237 2008-12-01 php-xml-5.1.6-23.el5.i386.rpm
-r--r--r-- 69 root root 57298 2008-12-01 php-xmlrpc-5.1.6-23.el5.i386.rpm
[root@dns Server]# rpm -ivh --aid php-common-5.1.6-23.el5.i386.rpm
warning: php-common-5.1.6-23.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:php-common ########################################### [100%]
[root@dns Server]# rpm -ivh --aid php-cli-5.1.6-23.el5.i386.rpm
warning: php-cli-5.1.6-23.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:php-cli ########################################### [100%]
[root@dns Server]# rpm -ivh --aid php-5.1.6-23.el5.i386.rpm
warning: php-5.1.6-23.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:php ########################################### [100%]
[root@dns Server]# rpm -ivh --aid php-pdo-5.1.6-23.el5.i386.rpm
warning: php-pdo-5.1.6-23.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:php-pdo ########################################### [100%]
[root@dns Server]# rpm -ivh --aid php-mysql-5.1.6-23.el5.i386.rpm
warning: php-mysql-5.1.6-23.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:php-mysql ########################################### [100%]
[root@dns Server]#
clip_image041
clip_image043
五、 编辑 Apache 配置文件 httpd.conf
2、vim /etc/httpd/conf/httpd.conf
1 )修改主配置文件 httpd.conf
设置Apache的根目录为/etc/httpd
设置客户端访问超时时间为120秒
这两个设置为系统默认――57行和68行
clip_image045
2 )设置客户端最大连接数为 1000 ―― 104 105
clip_image047
3 )设置 httpd 监听端口 80 ,默认―― 134
clip_image049
4 )设置管理员 E-mail 地址为 [email protected] ―― 251
设置 WEB 服务器的主机名和监听端口为 www.benet.com:80 ―― 265
clip_image051
5 )设置文档目录为 /var/www/html/bbs ―― 281
clip_image053
6 )允许所有人访问 /var/www/html/bbs 目录―― 306 333
clip_image055
clip_image057
7 )设置主页文件为 index.php ―― 397
clip_image059
7 修改 /security 目录设置权限
仅允许 tech.benet.com 域的客户端访问
<Directory "/security">
Options FollowSymLinks
Order allow,deny
Allow from .tech.benet.com
</Directory>
clip_image061
8 )设置服务器的默认编码为 GB2312 ―― 747
clip_image063
9 )重新启动 httpd
[root@dns Server]# mkdir /var/www/html/bbs (重要一步,不然不能启动)
[root@dns Server]# service httpd restart
停止 httpd: [失败]
启动 httpd: [确定]
六、下载动网论坛源码并使用 SSH 客户端软件(上传或下载)
动网官方地址http://p.dvbbs.net
创新时代、 PHP2.0++ 强劲推出http://p.dvbbs.net/dispbbs.php?boardid=11&id=32635&page=1
clip_image065
1、使用SSH软件(如图1
复制uploads目录里所有文件到/var/www/html/bbs目录
clip_image066
如图1
clip_image067
如图2
clip_image069
如图3
clip_image071
clip_image073
如图4
clip_image075
clip_image077
如图5
2、 更改目录权限
chmod -R 777 /var/www/html/bbs/
clip_image078
3、安装动网论坛
(1)IE输入http://192.168.1.200/install/index.php
clip_image080
(2)点击下一步
clip_image081
(3)点击下一步
clip_image082
(4)输入:数据库密码,并下一步
clip_image083
(5)点击下一步
clip_image084
(6)点击下一步
clip_image085
clip_image086
(7)点击下一步
clip_image087
clip_image088
(8)默认用户名和密码当然要全部改掉并下一步
clip_image089
clip_image090
clip_image091
(9)点击下一步
clip_image092
clip_image094
(10)安装完成
clip_image096
clip_image098
2、 升级动网论坛
下面我们来测试动网的升级程序Upgrade_Dvphp2.0_Sharp_GBK哈~
同样复制uploads目录里所有文件到/var/www/html/bbs目录
(1)SSH软件
clip_image099
clip_image101
clip_image103
clip_image105
(2)IE输入http://192.168.1.200/upgrade.php
clip_image107
clip_image109
clip_image111
(3) IE输入http://192.168.1.200/index.php
clip_image113
注意:
1
、升级不会删除原数据,但仍强烈建议在升级之前备份数据库
2
、升级过程可能需要很长时间,如果一次不成功,可以再次运行 upgrade.php
配置文件在附件里面:
如有不懂的地方,请call我!qq:357714938 mail:[email protected]

你可能感兴趣的:(apache,职场,休闲)