天天看點

apache伺服器

apache

軟體包:

   httpd-2.2.15-26.el6.x86_64.rpm

配置檔案:

    /etc/http/conf/httpd.conf

        /etc/http/conf.d/*.conf

服務資料目錄:

   /var/www/html

端口:80 443

切換程序和線程模式

vim /etc/sysconfig/httpd

   HTTPD=/usr/sbin/httpd.worker

釋出目錄

   cp -r /boot /var/www/html

測試:

   elinks 192.168.1.254

   elinks --dump 192.168.1.254

   elinks 192.168.1.254/boot

基于使用者家目錄釋出網頁

1.useradd robin

 useradd zorro

2.vim /etc/httpd/conf/httpd.conf

   <IfModule mod_userdir.c>

       #UserDir disabled

       UserDir public_html

   </IfModule>

3.建立

   mkdir /home/zobin/public_html

   mkdir /home/zorro/public_html

echo "robin's home" >> /home/robin/public_html/index.html

echo "zorro's home" >> /home/rorro/public_html/index.html

4.該權限

   chmod 777 /home/robin/

   chmod 777 /home/zorro/

5.service httpd restart

測試

elinks 192.168.1.254/~robin

elinks 192.168.1.254/~zorro

虛拟主機(任何目錄都可以放,關鍵字大小寫沒關系)

基于域名

1.

   mkdir /var/www/baidu/

   mkdir /var/www/google/

   NameVirtualHost *:80

   <VirtualHost *:80>

           documentroot /var/www/baidu

           servername www.baidu.com

   </VirtualHost>

3.建立頁面

echo "baidu" >> /var/www/baidu/index.html

echo "google" >> /var/www/google/index.html

4.設定解析 /etc/hosts (基于本機測試,)

192.168.1.254   www.baidu.com

192.168.1.254   www.google.com

5.啟動服務

service httpd restart

作業

ftp上傳資料

http釋出上傳網頁

防火牆關閉

[root@robin html]# rm -rf /etc/sysconfig/iptables

[root@robin html]# service iptables restart

iptables:清除防火牆規則:                                 [确定]

iptables:将鍊設定為政策 ACCEPT:mangle nat filter         [确定]

iptables:正在解除安裝子產品:                                   [确定]

[root@robin html]# iptables -L

Chain INPUT (policy ACCEPT)

target     prot opt source               destination        

Chain FORWARD (policy ACCEPT)

Chain OUTPUT (policy ACCEPT)

SElinux關閉

vim /etc/selinux/config

SELINUX=disabled