2013-11-27 101 views

回答

0

這應該是非常簡單明瞭:

  1. 安裝Apache(sudo aptitude install apache2
  2. 的默認配置點到/ var/WWW所以...
  3. 啓動Apache(sudo service apache2 restart
  4. 享受你的網站
  5. 您可以添加您的域名到/etc/hosts
  6. 採取一些步驟來保護你的專用服務器(iptables,fail2ban,...)

你也可以使用自動向導sudo dpkg-reconfigure apache2

我認爲這應該是足夠的,如果你的DNS已經指向你的IP。

如果你確實需要更改配置文件,它在etc/apache2/sites-available/default,包含以下(默認):

NameVirtualHost * 
<VirtualHost *> 
ServerAdmin [email protected] # <= Email of webadmin (shown on error pages) 

DocumentRoot /var/www/   # <= Root of your web server with public access 
<Directory /> 
    Options FollowSymLinks 
    AllowOverride None  # <= Disable usage of .htaccess files 
</Directory> 
<Directory /var/www/> 
    Options Indexes FollowSymLinks MultiViews 
    AllowOverride None 
    Order allow,deny 
    allow from all 
    # This directive allows us to have apache2's default start page 
      # in /apache2-default/, but still have/go to the right place 
      #RedirectMatch ^/$ /apache2-default/ 
</Directory> 

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ 
<Directory "/usr/lib/cgi-bin"> 
    AllowOverride None 
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch 
    Order allow,deny 
    Allow from all 
</Directory> 

ErrorLog /var/log/apache2/error.log 

# Possible values include: debug, info, notice, warn, error, crit, 
# alert, emerg. 
LogLevel warn 

CustomLog /var/log/apache2/access.log combined 
ServerSignature On 

Alias /doc/ "/usr/share/doc/" 
<Directory "/usr/share/doc/"> 
    Options Indexes MultiViews FollowSymLinks 
    AllowOverride None 
    Order deny,allow 
    Deny from all 
    Allow from 127.0.0.0/255.0.0.0 ::1/128 
</Directory> 

</VirtualHost> 

至於hosts文件,你可以添加以下內容:

# Host Database 
# 
# localhost is used to configure the loopback interface 
# when the system is booting. Do not change this entry. 
## 
127.0.0.1  localhost 

#Virtual Hosts 
12.34.56.789 example.com #<= change here :) 

然後,不要忘記用適當的工具(iptables,fail2ban,...)保護您的web服務器

相關問題