ServerAdmin 設置壹個郵件地址,如果服務器有任何問題將發信到這個地址, 這個地址會在服務器產生的某些頁面中出現。
#我們將ServerName導向固定ip,即將*改成我們的ip。
ServerName *:80
#我們修改了DocumentRoot目錄。
DocumentRoot /***
#將Options屬性改成FollowSymLinks。
Options FollowSymLinks
#將AllowOverride屬性改成ALL以支持.htaccess。
AllowOverride ALL
#我們配置了虛擬機,我們把*更改成我們的ip。
NameVirtualHost *:80
#虛擬機上拒絕了直接通過ip訪問我們的站點,我們把*更改成我們的ip。
< VirtualHost *:80>
ServerName *
< Location />
Order deny,allow
Deny from all
< /Location>
< /VirtualHost>
#我們將域名綁定到服務器,並將不帶3www的域名301重定向到帶www域名。
<VirtualHost *:80>
ServerAdmin admin@1try10.com
DocumentRoot 壹個目錄
ServerName 1try10.com
< ifModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^1try10.com [NC]
RewriteRule ^/(.*)$ /$1 [L,R=301]
< /ifModule>
ErrorLog /var/log/1try10.com-error_log
CustomLog /var/log/1try10.com-access_log common
< /VirtualHost>
< VirtualHost *:80>
ServerAdmin admin@1try10.com
DocumentRoot 壹個目錄
ServerName www.1try10.com
ErrorLog /var/log/1try10.com-error_log
CustomLog /var/log/1try10.com-access_log common
< /VirtualHost>
#我們設定了gzip壓縮
#gzip
< IfModule mod_deflate.c>
SetOutputFilter DEFLATE
DeflateCompressionLevel 5
AddOutputFilterByType DEFLATE text/html text/css image/gif image/jpeg image/png application/x-javascript
< /IfModule>
#TRACE和TRACK是用來調試web服務器連接的HTTP方式.支持該方式的服務器存在跨站腳本漏洞,所以我們關閉了它。
TraceEnable off?