歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Unix知識 >> 關於Unix

全力打造Linux服務器配置大全

一: DNS 服務器 的設置 1. 編輯/etc/named.conf // generated by named-bootconf.pl options directory "/var/named"; /* * If there is a firewall between you and nameservers you w ant * to talk to, you might need to uncomment the query-source *
  一: DNS服務器的設置
  1. 編輯/etc/named.conf
  // generated by named-bootconf.pl
  
  options {
  directory "/var/named";
  /*
  * If there is a firewall between you and nameservers you want
  * to talk to, you might need to uncomment the query-source
  * directive below. Previous versions of BIND always asked
  * questions using port 53, but BIND 8.1 uses an unprivileged
  * port by default.
  */
  // query-source address * port 53;
  };
  
  //
  // a caching only nameserver config
  //
  controls {
  inet 127.0.0.1 allow { localhost; } keys { rndckey; };
  };
  zone "." IN {
  type hint;
  file "named.ca";
  };
  
  zone "mydomain.com" IN {
  type master;
  file "named.mydomain.com";
  allow-update { none; };
  };
  
  zone "1.168.192.in-addr.arpa" IN {
  type master;
  file "named.mydomain.com.rev";
  allow-update { none; };
  };
  
  zone "localhost" IN {
  type master;
  file "localhost.zone";
  allow-update { none; };
  };
  
  zone "0.0.127.in-addr.arpa" IN {
  type master;
  file "named.local";
  allow-update { none; };
  };
  
  include "/etc/rndc.key";
  
  2. 編輯正向解析文件/var/named/named.mydomain.com
  $TTL 86400
  @ IN SOA my.mydomain.com. root.my.mydomain.com. (
  1997022700 ; Serial
  28800 ; Refresh
  14400 ; Retry
  3600000 ; Expire
  86400 ) ; Minimum
  IN NS my.mydomain.com.
  IN MX 10 my.mydomain.com.
  
  my IN A 192.168.1.50
  www IN CNAME my.mydomain.com.
  ftp IN CNAME my.mydomain.com.
  smtp IN CNAME my.mydomain.com.
  pop3 IN CNAME my.mydomain.com.
  
  3. 編輯反向解析文件/var/named/named.mydomain.com.rev
  $TTL 86400
  @ IN SOA my.mydomain.com. root.ns.mydomain.com. (
  1997022700 ; Serial
  28800 ; Refresh
  14400 ; Retry
  3600000 ; Expire
  86400 ) ; Minimum
  IN NS my.mydomain.com.
  
  50 IN PTR my.mydomain.com.
  
  4. 編輯/var/named/named.local文件
  $TTL 86400
  @ IN SOA my.mydomain.com. root.my.mydomain.com. (
  1997022700 ; Serial
  28800 ; Refresh
  14400 ; Retry
  3600000 ; Expire
  86400 ) ; Minimum
  IN NS my.mydomain.com.
  
  1 IN PTR localhost.
  
  5. 編輯/etc/resolv.conf
  # MADE-BY-RP-PPPOE
  domain mydomain.com
  nameserver 192.168.1.50
  search localdomain
  
  二: web服務器的設置
  只需對/etc/httpd/conf/httpd.conf進行部分修改即可
  ServerTokens OS
  
  ServerRoot "/etc/httpd" 注:指定守護進程httpd的運行目錄
  
  PidFile run/httpd.pid
  
  Timeout 300 注:定義客戶程序和服務器連接的超時間隔
  
  KeepAlive Off 注:定義是否支持一次連接,多次傳輸功能
  
  MaxKeepAliveRequests 100 注:一次連接可以進行的HTTP請求的最大請求次數
  
  KeepAliveTimeout 15 注:一次連接中的多次請求傳輸之間的時間
  
  MaxRequestsPerChild 0 注:每個子進程處理服務請求次數 0為無限次
  
  Listen 80
  
  User apache 注:指定用戶和組
  Group apache
  
  ServerAdmin [email protected] 注:服務器管理員的E_MAIL地址
  
  #ServerName 192.168.1.50:80 注:服務器域名,通常沒有dns才需要
  
  UseCanonicalName Off
  
  
  DocumentRoot "/var/www/html" 注:指定網頁文件存放位置
  
  
  <IfModule mod_userdir.c>
  
  UserDir user_www 注:用於個人主頁,一般為/home/user/網頁文件目錄
  
  </IfModule>
  
  DirectoryIndex index.html index.htm index.php 注:指定網站首頁名
  
  Aclearcase/" target="_blank" >ccessFileName .htaccess
  
  Alias /manual "/var/www/manual"
  
  <Directory "/var/www/manual">
  Options Indexes FollowSymLinks MultiViews
  AllowOverride None
  Order allow,deny
  Allow from all
  </Directory>
  注:以上是設置針對目錄進行文件的訪問控制
  ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
  
  <IfModule mod_cgid.c>
  Scriptsock run/httpd.cgid
  </IfModule>
  
  <Directory "/var/www/cgi-bin">
  AllowOverride None
  Options None
  Order allow,deny
  Allow from all
  </Directory>
  
  AddDefaultCharset GB2312 注:網站支持的字符編碼
  
  注:以下是設置虛擬主機服務所需配置的地方
  #NameVirtualHost 202.101.2.1 注:基於名字的虛擬主機必須,如基於IP地址則不需要
  
  #
  # VirtualHost example:
  # Almost any Apache directive may go into a VirtualHost container.
  # The first VirtualHost section is used for requests without a known
  # server name.
  #注:如果是基於IP地址的虛擬主機只需下面的設置即可
  #<VirtualHost 202.101.2.1>
  # ServerAdmin [email protected]
  # DocumentRoot /www/docs/dummy-host.example.com
  # ServerName dummy-host.example.com
  # ErrorLog logs/dummy-host.example.com-error_log
  # CustomLog logs/dummy-host.example.com-access_log common
  #</VirtualHost>
  注:基於名字即一個IP地址對應多個域名
  基於IP地址即每一個域名均有與之對應的IP

Copyright © Linux教程網 All Rights Reserved