Linux RedHat5 安装httpd 报错解决
[root@16nn.com ~]# rpm -ivh /media/Server/httpd-2.2.3-31.el5.i386.rpm
warning: /media/Server/httpd-2.2.3-31.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
libapr-1.so.0 is needed by httpd-2.2.3-31.el5.i386
libaprutil-1.so.0 is needed by httpd-2.2.3-31.el5.i386
此时报错,libapr-1.so.0在apr-1.2.7-11.el5_3.1.i386.rpm中,libaprutil-1.so.0在apr-util-1.2.7-7.el5_3.2.i386.rpm,安装这两个包
root@16nn.com ~]# rpm -ivh /media/Server/apr-1.2.7-11.el5_3.1.i386.rpm
root@16nn.com ~]# rpm -ivh /media/Server/apr-util-1.2.7-7.el5_3.2.i386.rpm
warning: /media/Server/apr-util-1.2.7-7.el5_3.2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
libpq.so.4 is needed by apr-util-1.2.7-7.el5_3.2.i386.rpm
又报错,libpq.so.4在包postgresql-libs-8.1.11-1.el5_1.1.i386.rpm
root@16nn.com ~]# rpm -ivh /media/Server/postgresql-libs-8.1.11-1.el5_1.1.i386.rpm
再重新安装apr-util这个包,最后再装httpd-2.2.3就OK了。
如果要启用SSL的话,需要再安装个软件包mod_ssl-2.2.3-31.el5.i386.rpm
[root@dfa ~]# rpm -ivh /media/Server/mod_ssl-2.2.3-31.el5.i386.rpm
warning: /media/Server/mod_ssl-2.2.3-31.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
libdistcache.so.1 is needed by mod_ssl-2.2.3-31.el5.i386
libnal.so.1 is needed by mod_ssl-2.2.3-31.el5.i386
可以看到报错了, 依赖libdistcache.so.1和libnal.so.1安装下面的包可解决
[root@16nn.com ~]# rpm -ivh /media/Server/distcache-1.4.5-14.1.i386.rpm
再安装就不会报错了
[root@16nn.com ~]# rpm -ivh /media/Server/mod_ssl-2.2.3-31.el5.i386.rpm
warning: /media/Server/mod_ssl-2.2.3-31.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:mod_ssl ########################################### [100%]
重启服务并查看443端口是否监听
[root@16nn.com ~]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@16nn.com ~]# netstat -ntpl | grep 443
tcp 0 0 :::80 :::* LISTEN 4432/httpd
tcp 0 0 :::443 :::* LISTEN 4432/httpd
至此已完成对Apache对SSL的支持,在浏览器中输入https://IP应该能正常访问。
证书的创建
cd /etc/pki/tls/certs/
make server.key
make server.crt
mv server.key ../private/
vi /etc/httpd/conf.d/ssl.conf
SSLCertificateFile /etc/pki/tls/certs/server.crt
SSLCertificateKeyFile /etc/pki/tls/private/server.key
虚拟主机:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/html/
</VirtualHost>
<VirtualHost *:80>
ServerName www.1.com
DocumentRoot /var/www/html/1
</VirtualHost>
<VirtualHost *:80>
ServerName www.2.com
DocumentRoot /var/www/html/2
</VirtualHost>
对www.2.com用htaccess实现用户认证
<Directory "/var/www/html/2">
Options FollowSymLinks
AllowOverride None
AuthType Basic
AuthName test
AuthUserFile /etc/httpd/conf/aufile
Require valid-user
</Directory>
htpasswd -c /etc/httpd/conf/aufile pp #创建文件aufile并新增用户pp
htpasswd /etc/httpd/conf/aufile oo #在原文件中新增用户oo
AddDefaultCharset GB2312 #设置默认编码为GB2312,不建议使用,注释掉后,浏览器会自动检测
<Directory "/var/www/html">
Options FolloSymLinks
AllowOverride None #设置.htaccess文件中的指令类型。None表示禁止使用.htaccess
Order allow,deny 默认拒绝所有,且allow字段在deny字段之前被匹配,或既匹配Allow又匹配Deny,则Deny生效
allow from all 如果是Order deny,allow,则默认允许所有,且Deny字段在Allow语句之前被匹配,若同时匹配Allow和Deny,则Allow生效
</Directory>
Option常用设置有:
FollowSymLinks 允许在目录中使用符号链接
Indexes 允许目录浏览,当目录下没有指定的首页文件时,则显示该目录的结构
MultiViews 允许内容协商的多重视图
ExecCGI 允许在该目录下执行CGI脚本
Includes 允许服务端包含内容
IncludesNoExec 同上,但不能执行CGI脚本
ALL 包含了除MultiViews之外的所有特性(如果没有Options字段,默认为ALL)
[root@16nn.com ~]# rpm -ivh /media/Server/httpd-2.2.3-31.el5.i386.rpm
warning: /media/Server/httpd-2.2.3-31.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
libapr-1.so.0 is needed by httpd-2.2.3-31.el5.i386
libaprutil-1.so.0 is needed by httpd-2.2.3-31.el5.i386
此时报错,libapr-1.so.0在apr-1.2.7-11.el5_3.1.i386.rpm中,libaprutil-1.so.0在apr-util-1.2.7-7.el5_3.2.i386.rpm,安装这两个包
root@16nn.com ~]# rpm -ivh /media/Server/apr-1.2.7-11.el5_3.1.i386.rpm
root@16nn.com ~]# rpm -ivh /media/Server/apr-util-1.2.7-7.el5_3.2.i386.rpm
warning: /media/Server/apr-util-1.2.7-7.el5_3.2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
libpq.so.4 is needed by apr-util-1.2.7-7.el5_3.2.i386.rpm
又报错,libpq.so.4在包postgresql-libs-8.1.11-1.el5_1.1.i386.rpm
root@16nn.com ~]# rpm -ivh /media/Server/postgresql-libs-8.1.11-1.el5_1.1.i386.rpm
再重新安装apr-util这个包,最后再装httpd-2.2.3就OK了。
如果要启用SSL的话,需要再安装个软件包mod_ssl-2.2.3-31.el5.i386.rpm
[root@dfa ~]# rpm -ivh /media/Server/mod_ssl-2.2.3-31.el5.i386.rpm
warning: /media/Server/mod_ssl-2.2.3-31.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
libdistcache.so.1 is needed by mod_ssl-2.2.3-31.el5.i386
libnal.so.1 is needed by mod_ssl-2.2.3-31.el5.i386
可以看到报错了, 依赖libdistcache.so.1和libnal.so.1安装下面的包可解决
[root@16nn.com ~]# rpm -ivh /media/Server/distcache-1.4.5-14.1.i386.rpm
再安装就不会报错了
[root@16nn.com ~]# rpm -ivh /media/Server/mod_ssl-2.2.3-31.el5.i386.rpm
warning: /media/Server/mod_ssl-2.2.3-31.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:mod_ssl ########################################### [100%]
重启服务并查看443端口是否监听
[root@16nn.com ~]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@16nn.com ~]# netstat -ntpl | grep 443
tcp 0 0 :::80 :::* LISTEN 4432/httpd
tcp 0 0 :::443 :::* LISTEN 4432/httpd
至此已完成对Apache对SSL的支持,在浏览器中输入https://IP应该能正常访问。
证书的创建
cd /etc/pki/tls/certs/
make server.key
make server.crt
mv server.key ../private/
vi /etc/httpd/conf.d/ssl.conf
SSLCertificateFile /etc/pki/tls/certs/server.crt
SSLCertificateKeyFile /etc/pki/tls/private/server.key
虚拟主机:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/html/
</VirtualHost>
<VirtualHost *:80>
ServerName www.1.com
DocumentRoot /var/www/html/1
</VirtualHost>
<VirtualHost *:80>
ServerName www.2.com
DocumentRoot /var/www/html/2
</VirtualHost>
对www.2.com用htaccess实现用户认证
<Directory "/var/www/html/2">
Options FollowSymLinks
AllowOverride None
AuthType Basic
AuthName test
AuthUserFile /etc/httpd/conf/aufile
Require valid-user
</Directory>
htpasswd -c /etc/httpd/conf/aufile pp #创建文件aufile并新增用户pp
htpasswd /etc/httpd/conf/aufile oo #在原文件中新增用户oo
AddDefaultCharset GB2312 #设置默认编码为GB2312,不建议使用,注释掉后,浏览器会自动检测
<Directory "/var/www/html">
Options FolloSymLinks
AllowOverride None #设置.htaccess文件中的指令类型。None表示禁止使用.htaccess
Order allow,deny 默认拒绝所有,且allow字段在deny字段之前被匹配,或既匹配Allow又匹配Deny,则Deny生效
allow from all 如果是Order deny,allow,则默认允许所有,且Deny字段在Allow语句之前被匹配,若同时匹配Allow和Deny,则Allow生效
</Directory>
Option常用设置有:
FollowSymLinks 允许在目录中使用符号链接
Indexes 允许目录浏览,当目录下没有指定的首页文件时,则显示该目录的结构
MultiViews 允许内容协商的多重视图
ExecCGI 允许在该目录下执行CGI脚本
Includes 允许服务端包含内容
IncludesNoExec 同上,但不能执行CGI脚本
ALL 包含了除MultiViews之外的所有特性(如果没有Options字段,默认为ALL)
[root@16nn.com ~]# rpm -ivh /media/Server/httpd-2.2.3-31.el5.i386.rpm
warning: /media/Server/httpd-2.2.3-31.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
libapr-1.so.0 is needed by httpd-2.2.3-31.el5.i386
libaprutil-1.so.0 is needed by httpd-2.2.3-31.el5.i386
此时报错,libapr-1.so.0在apr-1.2.7-11.el5_3.1.i386.rpm中,libaprutil-1.so.0在apr-util-1.2.7-7.el5_3.2.i386.rpm,安装这两个包
root@16nn.com ~]# rpm -ivh /media/Server/apr-1.2.7-11.el5_3.1.i386.rpm
root@16nn.com ~]# rpm -ivh /media/Server/apr-util-1.2.7-7.el5_3.2.i386.rpm
warning: /media/Server/apr-util-1.2.7-7.el5_3.2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
libpq.so.4 is needed by apr-util-1.2.7-7.el5_3.2.i386.rpm
又报错,libpq.so.4在包postgresql-libs-8.1.11-1.el5_1.1.i386.rpm
root@16nn.com ~]# rpm -ivh /media/Server/postgresql-libs-8.1.11-1.el5_1.1.i386.rpm
再重新安装apr-util这个包,最后再装httpd-2.2.3就OK了。
如果要启用SSL的话,需要再安装个软件包mod_ssl-2.2.3-31.el5.i386.rpm
[root@dfa ~]# rpm -ivh /media/Server/mod_ssl-2.2.3-31.el5.i386.rpm
warning: /media/Server/mod_ssl-2.2.3-31.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: Failed dependencies:
libdistcache.so.1 is needed by mod_ssl-2.2.3-31.el5.i386
libnal.so.1 is needed by mod_ssl-2.2.3-31.el5.i386
可以看到报错了, 依赖libdistcache.so.1和libnal.so.1安装下面的包可解决
[root@16nn.com ~]# rpm -ivh /media/Server/distcache-1.4.5-14.1.i386.rpm
再安装就不会报错了
[root@16nn.com ~]# rpm -ivh /media/Server/mod_ssl-2.2.3-31.el5.i386.rpm
warning: /media/Server/mod_ssl-2.2.3-31.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:mod_ssl ########################################### [100%]
重启服务并查看443端口是否监听
[root@16nn.com ~]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@16nn.com ~]# netstat -ntpl | grep 443
tcp 0 0 :::80 :::* LISTEN 4432/httpd
tcp 0 0 :::443 :::* LISTEN 4432/httpd
至此已完成对Apache对SSL的支持,在浏览器中输入https://IP应该能正常访问。
证书的创建
cd /etc/pki/tls/certs/
make server.key
make server.crt
mv server.key ../private/
vi /etc/httpd/conf.d/ssl.conf
SSLCertificateFile /etc/pki/tls/certs/server.crt
SSLCertificateKeyFile /etc/pki/tls/private/server.key
虚拟主机:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/html/
</VirtualHost>
<VirtualHost *:80>
ServerName www.1.com
DocumentRoot /var/www/html/1
</VirtualHost>
<VirtualHost *:80>
ServerName www.2.com
DocumentRoot /var/www/html/2
</VirtualHost>
对www.2.com用htaccess实现用户认证
<Directory "/var/www/html/2">
Options FollowSymLinks
AllowOverride None
AuthType Basic
AuthName test
AuthUserFile /etc/httpd/conf/aufile
Require valid-user
</Directory>
htpasswd -c /etc/httpd/conf/aufile pp #创建文件aufile并新增用户pp
htpasswd /etc/httpd/conf/aufile oo #在原文件中新增用户oo
AddDefaultCharset GB2312 #设置默认编码为GB2312,不建议使用,注释掉后,浏览器会自动检测
<Directory "/var/www/html">
Options FolloSymLinks
AllowOverride None #设置.htaccess文件中的指令类型。None表示禁止使用.htaccess
Order allow,deny 默认拒绝所有,且allow字段在deny字段之前被匹配,或既匹配Allow又匹配Deny,则Deny生效
allow from all 如果是Order deny,allow,则默认允许所有,且Deny字段在Allow语句之前被匹配,若同时匹配Allow和Deny,则Allow生效
</Directory>
Option常用设置有:
FollowSymLinks 允许在目录中使用符号链接
Indexes 允许目录浏览,当目录下没有指定的首页文件时,则显示该目录的结构
MultiViews 允许内容协商的多重视图
ExecCGI 允许在该目录下执行CGI脚本
Includes 允许服务端包含内容
IncludesNoExec 同上,但不能执行CGI脚本
ALL 包含了除MultiViews之外的所有特性(如果没有Options字段,默认为ALL)