天天看點

apache

http -l   # 列出靜态編譯的子產品

虛拟主機:

#---------------------------------------------------------------------------------

namevirtualhost *:80   # 沒有此行 虛拟主機不可用

<virtualhost *:80>

  servername www.a.com

  documentroot /var/www/a

</virtualhost>

  servername www.b.com

  documentroot /var/www/b

通路驗證:

htpasswd -c /etc/httpd/conf/users.db user1  #

<directory "/var/www/help">

    options indexes followsymlinks

        authtype basic

        authname "test manager login"

        authuserfile /etc/httpd/conf/users.db

        require valid-user

</directory>

ssl:

yum install mod_ssl

cd /etc/pki/tls/certs/

make testcert

cd /etc/pki/tls/private/

mv localhost.key localhost.key1

openssl rsa -in localhost.key1 -out localhost.key # 删啟動apache時的密碼

vim /etc/httpd/conf.d/ssl.conf

#----------------------------

<virtualhost 192.100.0.2>

servername www.rhce.com

documentroot /var/www/rhce

directoryindex index.html index.htm

serveradmin [email protected]

sslengine on

sslcertificatefile /etc/pki/tls/certs/localhost.crt

sslcertificatekeyfile /etc/pki/tls/private/localhost.key

service httpd restart

chkconfig httpd on

繼續閱讀