天天看點

HTTP

<b>HTTP</b>

<b>[root@server~]yum install http*</b>

<b>[root@server~]vim /etc/httpd/conf/httpd.conf</b>

<b>ServerRoot        “/etc/httpd</b>

<b>Listen      80</b>

<b>ServerName       192.168.0.4:80</b>

<b>DocumentRoot        “/var/www/html</b>

<b>DirectoryIndex       index.html         index.php”</b>

<b>#UserDir disable</b>

<b>UserDir   public_html</b>

<b>ServerAdmin     root@localhost</b>

<b>&lt;Directory         “/var/www/html/liuyang”&gt;</b>

<b>AllowOverride             AuthConfig</b>

<b>Order            allow,deny</b>

<b>Allow from all</b>

<b>&lt;/Directory&gt;</b>

<b>[root@server~]mkdir /var/www/html/liuyang</b>

<b>[root@server~]chmod 777 /var/www/html/liuyang</b>

<b>[root@server~]vim /var/www/html/liuyang/.htaccess</b>

<b>AuthName               “enter you accent and you passwd”</b>

<b>AuthType                 Basic</b>

<b>AuthUserFile          /var/www/html/liuyang/apache.passwd</b>

<b>require valid-user</b>

<b>[root@server~]htpasswd  –cm /var/www/html/liuyang/apache.passwd         jiangmin</b>

<b>[root@server~]vim /etc/sysconfig/iptables</b>

<b>-A RH-Firewall-1-INPUT –t tcp –deport 80 –j ACCEPT</b>

<b>-A RH-Firewall-1-INPUT –t udp –deport 80 –j ACCEPT</b>

<b>[root@server~]echo I am liuyang &gt; /var/www/html/liuyang/index.html</b>

<b></b>

<b>[root@client~]vim /etc/resolv.conf</b>

<b>Nameserver             192.168.0.1</b>

<b>[root@client~]firefox        www.baidu.com/liuyang/</b>

<b>虛拟主機</b><b></b>

<b>NameVirtualHost         *:80</b>

<b>&lt;VirtualHost           *:80&gt;</b>

<b>                 DocumentRoot        /baidu</b>

<b>ServerName            www.baidu.com</b>

<b>&lt;/VirtualHost&gt;</b>

<b>使用者驗證</b><b></b>

<b>&lt;Directory         “/baidu”&gt;</b>

<b>                 AllowOverride             AuthConfig</b>

<b>                 Order            allow,deny</b>

<b>                 Allow       from        all</b>

<b>HTTPS</b>

<b>[root@server~]yum install mod_ssl (https)</b>

<b>[root@server~]cd /etc/pki/tls/certs</b>

<b>[root@server~]make long.crt</b>

<b>[root@server~]vim /etc/http.d/conf.d/ssl.conf</b>

<b>SSLCertificateKeyFile /etc/pki/tls/certs/long.crt</b>

<b>SSLCertificateKeyFile /etc/pki/tls/certs/long.key</b>

<b>[root@server~]service saslauthd restart</b>

<b>[root@server~]service httpd restart</b>

<b>第一次使用</b><b>HTTPS</b><b>後會記錄證書</b><b></b>