标签:strong error_log 技术分享 情况 服务 生效 str rmi --
[root@localhost ~]# wget http://mirrors.hust.edu.cn/apache/httpd/httpd-2.2.32.tar.bz2
[root@localhost ~]# yum install -y apr-util apr-devel apr-util-devel
[root@localhost ~]# tar jxvf httpd-2.2.32.tar.bz2
[root@localhost ~]# cd httpd-2.2.32
[root@localhost httpd-2.2.32]# ./configure --prefix=/usr/local/httpd --enable-rewrite --enable-so
[root@localhost httpd-2.2.32]# make
[root@localhost httpd-2.2.32]# make install
[root@localhost httpd-2.2.32]# ln -s /usr/local/httpd/bin/* /usr/local/bin/
[root@localhost httpd-2.2.32]# httpd -t
httpd: Could not reliably determine the server‘s fully qualified domain name, using localhost.localdomain for ServerName
Syntax OK
[root@localhost httpd-2.2.32]# /usr/local/httpd/bin/apachectl start
[root@localhost httpd-2.2.32]# lsof -i :80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 10535 root 4u IPv6 34976 0t0 TCP *:http (LISTEN)
httpd 10536 daemon 4u IPv6 34976 0t0 TCP *:http (LISTEN)
httpd 10537 daemon 4u IPv6 34976 0t0 TCP *:http (LISTEN)
httpd 10538 daemon 4u IPv6 34976 0t0 TCP *:http (LISTEN)
httpd 10539 daemon 4u IPv6 34976 0t0 TCP *:http (LISTEN)
httpd 10540 daemon 4u IPv6 34976 0t0 TCP *:http (LISTEN)
【apache虚拟主机生产应用】
[root@localhost ~]# cd /usr/local/httpd/htdocs/
[root@localhost htdocs]# mkdir www1 www2
[root@localhost htdocs]# ls
www1 www2
[root@localhost ~]# vim /usr/local/httpd/conf/httpd.conf #开启虚拟主机认证模块功能
[root@localhost htdocs]# vim /usr/local/httpd/conf/extra/httpd-vhosts.conf
NameVirtualHost *:80 #指定一个机遇域名的虚拟主机将使用哪个IP地址接受请求
<VirtualHost *:80>
ServerAdmin bixiaoyu@staff.hexun.com
DocumentRoot "/usr/local/httpd/htdocs/www1"
ServerName www.wugk1.com
<Directory "/usr/local/httpd/htdocs/www1"> #设置指定目录的访问权限,
AllowOverride All #AllowOveride设置None时,.htaccess文件将被忽略,指令设置为All时,所有具有“.htaccess”作用域将生效
Options -Indexes FollowSymLinks # 禁止显示目录,如果要以目录显示需要改成Options Indexes FollowSymLinks
Order allow,deny #默认情况下禁止所有客户端访问,order deny,allow默认情况下允许所有客户端访问,
Allow from all #允许所有客户端访问
</Directory>
ErrorLog logs/error_log
CustomLog logs/access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin bixiaoyu@staff.hexun.com
DocumentRoot "/usr/local/httpd/htdocs/www2"
ServerName www.xiaoyu.com
<Directory "/usr/local/httpd/htdocs/www2">
AllowOverride All
Options -Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
ErrorLog logs/error_log
CustomLog logs/access_log common
</VirtualHost>
[root@localhost ~]# vim /etc/hosts #在本地和服务器上配置域名解析,随后即可!
192.168.2.139 www.xiaoyu.com,www.test.com
[root@localhost ~]# /usr/local/httpd/bin/apachectl restart #重启生效
标签:strong error_log 技术分享 情况 服务 生效 str rmi --
原文地址:http://www.cnblogs.com/bixiaoyu/p/7833945.html